• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to Open .doc file with in browser ?

 
P Srini
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I have a requirement here

When User clicks on a link or a button then I want to display a word document (.doc file ) say his profile to him within the browser

Could you please let me know how to that ?

Thanks,
Srinivas.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17620
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please find a friend to help your English? I'm not sure we can understand what you want to know.

However, Microsoft lost a very large lawsuit (over $500 million) with a small company called Eolas several years ago and as part of the settlement of that lawsuit, Internet Explorer is no longer allowed to open Word Documents, Excel spreadsheets, PDF's and other similar files in the browser window.

So far, Internet Explorer is the only browser that's been restricted that way, not Firefox, Opera, or browsers for other OS's such as Apple's Safari. But in Windows/IE, the browser windows cannot be used and the document is opened in a new window. Older versions of IE did not always get "fixed", so some of them will, but anything that old may have other problems by now.
 
Ad Rajesh
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi try this,

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="application/msword; charset=ISO-8859-1">
<title>Index Page</title>
</head>
<body>
<form>
Click here to open the document.
</form>
</body>
</html>

href refers to the path of your document.
 
P Srini
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Mr. Tim, My apologies for the mistake in the Text.

My intension is as you got it right, I want to read a msword document, and show it to the user in the browser itself.
Hi Rajesh,
Thanks for the reply.
I tried the code snippet that you provided, but my browser is asking me for confirmation to open the document in MS Word application.

I think I have to use POI for my requirement. Please let me if there is any simple solution.

Thanks,
Srini.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17620
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
POI won't allow you to show the document in the browser. POI creates Word-format documents, but Internet Explorer is forbidden from opening Word documents in its own browser windows, regardless of where they came from or how they were generated.

It's not a technical problem, it's a legal issue. Microsoft isn't allowed to open MS-Office documents in IE windows, even if the documents themselves were created by something other than MS-Office.

You might be able to work around this using Google documents or some sort of mechanism like that. It still wouldn't allow you to actually open "Word" documents, but it might present the document in a form that meets Microsoft's legal limitations while still being close enough for users.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17620
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, the simplest solution is to use Firefox, and not Internet Explorer. Firefox doesn't have that legal restriction.

Unfortunately, a lot of companies won't allow a choice.
 
Paul Clapham
Sheriff
Pie
Posts: 20171
25
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you explain why it is so important to open the document inside the browser instead of outside the browser?
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic