• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Print Documents

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hy, I'm translating an application from standard Windows environment to web/Servlet/JSP. This application is a data entry that at the end print some documents. These documents are in MSWord fromat and contains some DOCVARIABLE Fields to be filled. Now I know there is no pure java api to read MSWord documents, has anybody an idea of what is the better way. I mean save documents in RTF and use docvar, save documents in htm and ad some javascript code or any other format?
My Servlet or JSP has to fill the fields and send to the browser for printing.

Thanks for any clue
 
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Paolo,

Welcome to the ranch. First, please don't cross post your questions. Some ranchers who read several of the forums will get annoyed by cross posts and may be less likely to help out. Also, it makes it hard to follow the conversation when people are posting to two different places.

Now, with regards to your question...

My first suggestion would be to save the documents in xml format and parse through them like that. Microsoft Word 2003 and later have the ability to save into XML format, and it is pretty easy to parse through and populate whatever variables you need to before printing off the document.

There are also some APIs out there that can read Word documents. Off the top of my head, I believe the JACOB project, Jakarta POI, and OpenOffice all have API that can read and manipulate Word data. Google them and see what you come up with. Good Luck, and if you have more questions, ask!
 
Paolo Botta
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry for the croos, I was not sure the right place was JSP or Servlet.
First part of your answer is really intersting, I have to study it a little.
Second part can't be used, I have to compile the document on the server (AIX) and can't use jacob or any solution not pure java.

I tried to save (from WORD 2000) the doc in html and it produce a lot of html/xml and something else, but there are no true variables that I can compile. I'm going to try WORD 2003.

Thanks again
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic