This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

How to create MS Word Doc using HWPF

 
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
 
Rancher
Posts: 43011
76
  • 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 ]
 
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: 43011
76
  • 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.
 
Catch Ernie! Catch the egg! And catch this tiny ad too:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!