wood burning stoves 2.0*
The moose likes Other Open Source Projects and the fly likes HWPF POI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "HWPF POI" Watch "HWPF POI" New topic
Author

HWPF POI

Rishi Kanth
Ranch Hand

Joined: May 23, 2006
Posts: 43
Hey All,

I have previously used Apache POI to generate XL reports. I am trying to use the POI for generating word reports. I am able to read the word document using HWPFDocument and POIFS input stream. How can I obtain the formating of the paragraph or words. if I have for example, Hello. How can I know that the read word from the document "Hello" is bold.

Thanks,
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41060
    
  43
From all Range objects (like Paragraphs) you can obtain a list of CharacterRun objects for that Range - those have style information associated with them.


Ping & DNS - my free Android networking tools app
Rishi Kanth
Ranch Hand

Joined: May 23, 2006
Posts: 43
Hey

Thanks for the reply. I was able to get the properties of the CharacterRun/Paragraph. I am having trouble rreading/writing Tables to the word document.
Currently I am using the following code to get the Table, but its throwing an exception


I get the following exception


Can someone please help me to read/write tables and image to the DOC using POI.

Thanks,>
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41060
    
  43
Not sure what's happening, but here's some code I used to examine tables which worked fine as I recall.

Note that working with HWPF tables is buggy: https://issues.apache.org/bugzilla/show_bug.cgi?id=47563
jetti madhu
Greenhorn

Joined: Feb 22, 2010
Posts: 7
Hi to all,
Is there any chance to get and set an Tables and Images height ,width and position in a word document(.doc and .docx format) by using POI jar....?
Please suggest possibilities.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41060
    
  43
I'm not sure what you mean by "position in a document", but image width and height are available through the org.apache.poi.hwpf.usermodel.Picture class. Curiously, it doesn't seem to have an XWPF equivalent.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HWPF POI
 
Similar Threads
Help on Reports in java.
Apache POI -HWPF Word Document not appending using document.write(stream)
insert header and footer with POI HWPF?
Java component(POI or OpenOffice API) to insert Hyperlink in word doc
Data export from Java to Office