The Artima Developer Community
Sponsored Link

Java Answers Forum
How to create Word doc programatically

1 reply on 1 page. Most recent reply: Feb 19, 2009 6:56 AM by nikola dangubic

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
David Pantich

Posts: 1
Nickname: pantichd
Registered: Jan, 2009

How to create Word doc programatically Posted: Jan 3, 2009 9:34 AM
Reply to this message Reply
Advertisement
Hello,

I need to be able to generate a Word document in my servlet. I've looked around but haven't found much that seems to do what I need. The most promising one seemed to be Apache's POI (http://poi.apache.org/) but the Word part of it doesn't seem to be able to write Word documents the way I need it to.

Ideally, here's what I'd like to do: First I'd have a Word document that would act as a "template". It would look like the paper form we're replacing but would have some unique strings in each field where user would normally have written something.

In my servlet I would read in the "template" file and use the request parameters to replace the unique strings in the fields. Then I would write out the modified Word document to another file.

Seems simple enough but I'm not able to find anything that can do this. I would greatly appreciate any hints/suggestions on how to do this.

Actually, the final goal is to take the new Word file and generate a PDF out of it for future retention in our record retention software. That software only accepts PDFs. I chose Word as the intermediate format because it seemed to be the best way to generate a file that most closely resembled the paper form that's being replaced. If anyone has a better way to do this I'd love to hear it.

The main thing is that I'd like to use open source software to accomplish this. I don't think I can get approval to buy more software at this point.

Thanks in advance for any help!

David


nikola dangubic

Posts: 1
Nickname: tropical
Registered: Feb, 2009

Re: How to create Word doc programatically Posted: Feb 19, 2009 6:56 AM
Reply to this message Reply
If the Word is not mandatory for this process it is best to use JasperReports api. First you have to create japser template, best to do this with iReport tool [http://jasperforge.org/plugins/project/project_home.php?group_id=83]. Then for each new report you fill the template with appropriate values. At the end you print that report in PDF format.

cheers

Flat View: This topic has 1 reply on 1 page
Topic: JDBC Previous Topic   Next Topic Topic: All about S60 5th edition in Nokia Code Camp at Kuala Lumpur

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use