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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "How to create MS Word Doc using HWPF" Watch "How to create MS Word Doc using HWPF" New topic
Author

How to create MS Word Doc using HWPF

ved gunjan
Ranch Hand

Joined: May 17, 2003
Posts: 86
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
Marshal

Joined: Mar 22, 2005
Posts: 42367
    
  64
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 ]

Ping & DNS - my free Android networking tools app
M. White
Greenhorn

Joined: Dec 27, 2009
Posts: 18

Can you give a reliable api for creating .doc file?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42367
    
  64
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.
 
 
subject: How to create MS Word Doc using HWPF