Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

HWPF POI

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic