File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes How to open MS Word from Java 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 » Java in General
Bookmark "How to open MS Word from Java" Watch "How to open MS Word from Java" New topic
Author

How to open MS Word from Java

Venkatesh buddala
Greenhorn

Joined: Apr 11, 2006
Posts: 2
Hi, Friends
Please slove my problem ..

I want to open Ms-word & load a .doc file when a button clicks from AWT GUI Application.

Actually i want to save my database out put into an ms-word document & open it from Java AWT Application(when a button clicks).

for Generating MSWORD
We generated the db output & add html tags and written into File & save this files with .doc extension. this is solve the problem of generating MSWord file & MS-WORD interpreting these files proparly.

But now i want to Open MS-WORD & load the generated file.could you some one please give the solution & also is there any better way to generate ms-word files from java.

Thanks in Advance
nomeaning
Greenhorn

Joined: Sep 16, 2005
Posts: 21
You must read POI

http://jakarta.apache.org/poi/index.html

Hope this information is useful
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41155
    
  45
OK, so you're already creating files that Word can open. In that case you don't need POI. What happens if you stream the Word file to the browser - does it not cause Word to be opened, or at least the user to be asked what he wants to do with the file?


Ping & DNS - my free Android networking tools app
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
From the command line, you'd use

start filename.doc

to open word with the file. Executing that line with Runtime.exec should give you the desired result. Of course that only works on Windows...

Not a GUI question, moving to Java in General...


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to open MS Word from Java
 
Similar Threads
cannot open office2007 documents from the java application
Opening Excel sheet in a browser
JSP to MS Word without 'Save as...' dialog
Can Servlet out data as MS-WORD format?
MS Word to XML conversion