wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes creating word document from java application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "creating word document from java application" Watch "creating word document from java application" New topic
Author

creating word document from java application

jamie ong
Greenhorn

Joined: Nov 05, 2001
Posts: 24
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

Joined: Jan 10, 2002
Posts: 60804
    
  65

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jorge Phillips
Ranch Hand

Joined: Jun 03, 2001
Posts: 43
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

Joined: Dec 10, 2001
Posts: 7023
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.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: creating word document from java application
 
Similar Threads
Java Api for converting Word document to PDF?
How to generate dynamic word document?
Can java send command to keyboard???
How to read MSWORD and MSEXCEL document
Executing a word macro on a document from java