You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "Andrew J. Miller" <aj...@fstrf.org> on 2006/10/26 00:04:47 UTC

Text box in excel spreadsheet... Extracting text possible?

Hi all!

I'm working on changing a "pretty" spreadsheet into a basic 
"not-so-pretty-but-easy-to-work-with" spreadsheet and then copy that 
data into a couple of databases.  There are a ton of text boxes within 
the original "pretty" excel file that contain data I have to use.   Does 
anyone know if it is possible to identify the objects within the sheet 
(in this case, a text box) and then extract the text from it?  I've only 
found solutions on adding and positioning new text boxes in an excel 
spreadsheet, not getting info from an existing one...

Thanks for the help!
Andy

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: Text box in excel spreadsheet... Extracting text possible?

Posted by Daniel Noll <da...@nuix.com.au>.
Mike Bauer wrote:
> Hi Daniel,
> 
> Thanks for your response. But can you please elaborate a little more. 
> For eg. If I have a textbox named "TB1", how do I get the text that is actually
> stored in it? 

Like I said, all we needed was the text so we didn't look at the other 
metadata available in the TextObjectRecord class.  It may or may not 
have a method which returns the value "TB1" which you are looking for.

Daniel



-- 
Daniel Noll

Nuix Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia    Ph: +61 2 9280 0699
Web: http://www.nuix.com.au/                        Fax: +61 2 9212 6902

This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: Text box in excel spreadsheet... Extracting text possible?

Posted by Mike Bauer <la...@gmail.com>.
Hi Daniel,

Thanks for your response. But can you please elaborate a little more. 
For eg. If I have a textbox named "TB1", how do I get the text that is actually
stored in it? 

Thanks
Mike


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: Text box in excel spreadsheet... Extracting text possible?

Posted by Daniel Noll <da...@nuix.com.au>.
Andrew J. Miller wrote:
> Hi all!
> 
> I'm working on changing a "pretty" spreadsheet into a basic 
> "not-so-pretty-but-easy-to-work-with" spreadsheet and then copy that 
> data into a couple of databases.  There are a ton of text boxes within 
> the original "pretty" excel file that contain data I have to use.   Does 
> anyone know if it is possible to identify the objects within the sheet 
> (in this case, a text box) and then extract the text from it?  I've only 
> found solutions on adding and positioning new text boxes in an excel 
> spreadsheet, not getting info from an existing one...

I can get you part of the way there.

   POIFSFileSystem fileSystem = ...;

   HSSFRequest hssfRequest = new HSSFRequest();
   hssfRequest.addListener(new HSSFListener() {
     public void processRecord(Record record) {
       TextObjectRecord textObject = (TextObjectRecord) record;

       // Do stuff
     }
   }, TextObjectRecord.sid);

   HSSFEventFactory eventFactory = new HSSFEventFactory();
   eventFactory.processWorkbookEvents(hssfRequest, fileSystem);

But we only extract the text, so I don't actually know if 
TextObjectRecord contains information on what sheet the object is on.

Daniel


-- 
Daniel Noll

Nuix Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia    Ph: +61 2 9280 0699
Web: http://www.nuix.com.au/                        Fax: +61 2 9212 6902

This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/