Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
I am searching a code for displaying the content of a DOC File inside a Web Page using JAVA(either jsp or servlet) but I have no luck finding it. Can someone show me an example of this or just a link.

A little overview of this Program:
A Web Application that allows user to view a Word Document(unable to edit or download the Doc File)

Thanks...
Posted
Updated 1-Mar-12 4:38am
v3

one does not simply present a word document in a browser.
Because a browser cannot understand doc files.

What you can do is to get the decent program to open that file for you.
You can ask the OS to show you the program and then let the program open that doc file:

Java
final Program p = Program.findProgram("doc"); // find program to open doc file
p.execute(printFilePath); // let program open doc file


That is pretty safe and for example often done with PDF.
If no program is installed you'll get a download dialog window.
 
Share this answer
 
Comments
hansoctantan 1-Mar-12 1:56am    
That's a good suggestion but I want to display the DOC File to a Web Page so that user can only view the Doc File without the function to modify.
TorstenH. 1-Mar-12 5:23am    
read the doc file and display the content in a web page. That wuold be best and does not require any plugins or whatever.

Can't you use PDF?
hansoctantan 1-Mar-12 5:42am    
I'm finding a way to convert DOC to PDF but all I find is code that has error...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900