Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to create MS Word Doc using HWPF

 
ved gunjan
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ho All,
I need to generate a MS Word Document with data fetched from DB.
If there are any url or sample code exist which can guide me through this.
It would be great any one can provide me with some valuble input.

Thanks and Regards.
Ved
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure that HWPF is up to the task of creating word files. This page may be your best bet looking for example code.

The OpenOffice Java API may be more usable for this, but has a definite learning curve; see AccessingFileFormats for some links.
[ April 25, 2007: Message edited by: Ulf Dittmer ]
 
M. White
Greenhorn
Posts: 18
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you give a reliable api for creating .doc file?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, POI HWPF has improved over the last few years, so you may want to give it a shot; see this example: http://faq.javaranch.com/java/CreateWordDocument

An alternative might be to create an RTF document, which Word can read just fine; see Why are the Microsoft Office file formats so complicated? (And some workarounds) for some more advice on the topic of creating binary Office files.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic