• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

creating word document from java application

 
jamie ong
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
my java application requires to create a record catalog in ms word document. is there any possible way to do so?
many thanks!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Off the top of my head, two means come to mind:
1) Use JNI to interact with C++ code that uses COM to interact with Word. (GA!)
2) Emit RTF which Word will read in just fine but which is a lot easier to generate.
Not really my area of expertise so others may have better ideas.
hth,
bear
 
Jorge Phillips
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about just writing out a text file (possibly with a .txt extension) and reading it into Word. Word should convert the file automatically. You can then save the file as a .doc file and then apply any formatting you need using macros, etc. to expedite the process.
If this is a one shot deal, I would favor this approach.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would definitely prefer to use Java to generate RTF documents than Word documents. Word is very proprietary and this year's Word document format is not next year's Word document format is not last year's Word document format.
I have not yet run across an API that just outputs Word documents from Java. I know the group working on the POI project over at Jakarta are developing such an API to generate Word '97 documents. I'm not sure how far along they are. Take a look at their project site for more information.
Mueller Und Stein offer a free Java Bean to control Microsoft Word.
Otherwise, perhaps there is an indirect path through XML to get from Java to Word (and perhaps back again).
Good Luck.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic