This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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: 41151
    
  45
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: 41151
    
  45
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: 41151
    
  45
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.
 
jQuery in Action, 2nd edition
 
subject: HWPF POI
 
Similar Threads
Data export from Java to Office
Help on Reports in java.
insert header and footer with POI HWPF?
Apache POI -HWPF Word Document not appending using document.write(stream)
Java component(POI or OpenOffice API) to insert Hyperlink in word doc