Thanks for teh response :

these are not embedded files.
But tables created by :
1. select a rectangle region of cells
2. From Home -> Format as Table > Medium

So now an area of my sheet has a table. This Table has its own Header Row and 
contents

I can read teh whole sheet without any problem.
But I would like to read the tables within the sheet. ( I would like to 
recognize that the sheet has multiple tables contained within and be able to 
read their headers )

Im starting to suspect that POI cannot do this.

--sony


--- On Mon, 4/26/10, MSB <[email protected]> wrote:

> From: MSB <[email protected]>
> Subject: Re: Is it possible to read a table from Excel
> To: [email protected]
> Date: Monday, April 26, 2010, 1:35 AM
> 
> Can I ask what may seem a stupid question please? What do
> you mean by
> 'retrieve them as individual tables'? Do you want to read
> the contents of
> the embedded files using POI or simply extract them from
> the 'host'
> document?
> 
> I am going to assume that you can do the former using POI
> and the latter
> would actually be quite straightforward; once you have the
> embedded object
> as an XSSFWorkbook, simply pass an OutputStream to it's
> write() method.
> 
> Yours
> 
> Mark B
> 
> 
> Sony Antony-3 wrote:
> > 
> > Thank you very much for the reply Mark :
> > Actually I had already tried getAllEmbedds().
> > ( Nothing gets printed below ) L
> > FileInputStream fis = new FileInputStream(file);
> > XSSFWorkbook wb = new XSSFWorkbook(fis);
> > List<PackagePart> emb = wb.getAllEmbedds() ;
> > for( PackagePart pp : emb ){
> > 
>    System.out.println("ZZZ"+pp.getContentType());
> > }
> > 
> > 
> > Does it make any difference how the XSSFWorkbook
> object is instantiated. I
> > mean, am I using the wrong constructor. ?
> > 
> > ( The way it is, I can read individual cell's
> contents. I just cant
> > retrieve them as individual tables. )
> > 
> > --sony
> >         
> > 
> > 
> > 
> > --- On Sun, 4/25/10, MSB <[email protected]>
> wrote:
> > 
> >> From: MSB <[email protected]>
> >> Subject: Re: Is it possible to read a table from
> Excel
> >> To: [email protected]
> >> Date: Sunday, April 25, 2010, 9:51 AM
> >> 
> >> Take a look at this;
> >> http://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFWorkbook.html#getAllEmbedds%28%29
> >> because, as the tables are embedded, this is the
> most
> >> likely way to retrieve
> >> a reference to them.
> >> 
> >> That method returns a List containing zero, one or
> more
> >> elements of type
> >> org.apache.poi.openxml4j.opc.PackagePart which you
> can then
> >> process using
> >> POI again - that is assuming they are all Excel
> workbooks.
> >> If you look at
> >> the constructor for the XSSFWorkbook class, you
> will see
> >> that one takes a
> >> reference to an OPCPackage object and it is
> possible to
> >> retrieve just such
> >> an object from the PackagePart by calling it's -
> that is
> >> the PackagePart(s)
> >> - getPackage() method.
> >> 
> >> Have never tried it myself but I think that will
> work.
> >> 
> >> Yours
> >> 
> >> Mark B
> >> 
> >> 
> >> 
> >> Sony Antony-3 wrote:
> >> > 
> >> > Hello :
> >> > We have an excel workbook in the new XSSF
> format, with
> >> multiple embedded
> >> > tables.
> >> > When I do a Workbook.getNumberOfNames(), I
> get zero.
> >> > 
> >> > Is it possible to read embedded tables using
> POI.
> >> > 
> >> > Any help will be greatly appreciated.
> >> > 
> >> > Thanks
> >> > --sony
> >> > 
> >> > 
> >> >       
> >> > 
> >> >
> >>
> ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: [email protected]
> >> > For additional commands, e-mail: [email protected]
> >> > 
> >> > 
> >> > 
> >> 
> >> -- 
> >> View this message in context:
> >> http://old.nabble.com/Is-it-possible-to-read-a-table-from-Excel-tp28356078p28356524.html
> >> Sent from the POI - User mailing list archive at
> >> Nabble.com.
> >> 
> >> 
> >>
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [email protected]
> >> For additional commands, e-mail: [email protected]
> >> 
> >> 
> > 
> > 
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> > 
> > 
> > 
> 
> -- 
> View this message in context: 
> http://old.nabble.com/Is-it-possible-to-read-a-table-from-Excel-tp28356078p28361330.html
> Sent from the POI - User mailing list archive at
> Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to