Bib

Once you read in the HWPFDocument, you should be able to get the
text via the Text Table

Here is a snippet of code to help:

                try {
                        fs = new POIFSFileSystem(new
FileInputStream(fileName));
                        doc = new HWPFDocument(fs);
                        range = doc.getRange();
                        //if (!doc.getFileInformationBlock().isFDot()) {
                        //      throw new Exception("Not a Template File");
                        //}
                } catch (FileNotFoundException e) {
                        e.printStackTrace();
                        throw e;
                } catch (IOException e) {
                        e.printStackTrace();
                        throw e;
                }

To get the Text

                TextPieceTable table0 = doc.getTextTable();
                List runs0 = table0.getTextPieces();
                log.info("TextPieceTable");
                if (log.isDebugEnabled()) {
                        for (int i=0; i<runs0.size(); i++) {
                                TextPiece value = (TextPiece)runs0.get(i);
                                byte[] buff = value.getRawBytes();
                                for (int j=0; j<buff.length; j++) {
                                        log.debug("BYTE " + j + ": " +
buff[j] + " " + (char)buff[j]);
                                }
                                log.debug("Index: " + i + " Start: " +
value.getStart() + " End: " + value.getEnd());
                                log.debug("Data: " +
((TextPiece)doc.getTextTable().getTextPieces().get(0)).substring(value.getSt
art(), value.getEnd()));
                        }
                } 

-----Original Message-----
From: bib_lucene bib [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 23, 2006 8:24 PM
To: POI Users List; [EMAIL PROTECTED]
Subject: RE: hwpf library

I have downloaded latest POI and it has
poi-scratchpad-2.5.1-final-20040804.jar. It does not have hwpf package. 
  I read content from word doc and display in html, the documents have text
only no images.
   
  Can you please tell me where to get the jar file of this library. A link
will be great.
   
  Thanks
  bib/-

Joseph Favero <[EMAIL PROTECTED]> wrote:
  Bib

What kind of content are your reading.
I have done some work on getting merge fields to work and have a working
version.

Thanx Joe 

-----Original Message-----
From: bib_lucene bib [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 23, 2006 6:15 PM
To: [email protected]
Subject: hwpf library

Hi All

How do I get hwpf, is there a jar file I can get that has this package.
I am trying to read content from a word document. I am planning to use
org.apache.poi.hwpf.HWPFDocument; But I could not find the library(jar) to
import.

Please lte me know.

bib/-


---------------------------------
Yahoo! Mail
Use Photomail to share photos without annoying attachments.



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



                
---------------------------------
 Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new
and used cars.



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

Reply via email to