• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HWPF POI

 
Rishi Kanth
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From all Range objects (like Paragraphs) you can obtain a list of CharacterRun objects for that Range - those have style information associated with them.
 
Rishi Kanth
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic