• 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
  • Devaka Cooray
  • Tim Cooke
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
Saloon Keepers:
  • Piet Souris
Bartenders:

creating word document from java application

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Sheriff
Posts: 67762
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic