Open DOC files in browser instead of downloading

Vikas

New Member
Hello All,

I am facing a problem while opening a doc file from my web page. Actually i am converting the .doc file to .mht before displaying it inside the browser. To display the .mht file, I am using content-type:"message/rfc822" and content-disposition:inline. This works fine in IE but in other browsers files are getting downloaded.

Any body can help on this please!!!

Regards,
Vikas Verma
 
Hi

Knowing nothing about .mht files I did a quick Google and found this "What it .mht". It seams to me the .mht files are some sort file format which is unique to Internet Explorer and only IE naturally knows how to view/render/display this file format. Other browsers seam to need a plug-in/add-on installed to be able to handle this particular file type.

This would explain why other browsers would want to download it as a file because it's foreign file format and would not know what to do with it.

Hope this answers your question.
 
Thanks for your response.
Actually i am already familiar with the suggestion that you have provided.

Actually the purpose of converting the .doc file to .mht is so that i could be able to open the file within the browser. If i used .doc file then this also getting downloaded in all browsers including IE. What I want is to restrict the downloading process. I just wanted to open the file within the browser.

please suggest if u have any idea??
 
In theory, since a .mht file is a multi-part file you could process the file through a rip-mime utility. What is does it breaks down each mime block of the .mth into it's separate files. Have your web server handle the delivering of the files, but I don't think this will update/modify the src attributes in the html of the files.

Or if you are feeling confident, you could write your own mime ripper parser in the ABL to handle all the mime parts. Biggest problem is handling quoted printable text and parsing and modifying src location within the HTML to have the location point in the right place.

Windows utility to unpack multi-mime encode files (like emails).
http://sourceforge.net/projects/mpack-win/
 
Thanks for your response.
Actually i am already familiar with the suggestion that you have provided.

Actually the purpose of converting the .doc file to .mht is so that i could be able to open the file within the browser. If i used .doc file then this also getting downloaded in all browsers including IE. What I want is to restrict the downloading process. I just wanted to open the file within the browser.

please suggest if u have any idea??

Forget about using .mht files for a moment, what about trying to convert .doc file to .svg???

Deliver the contents of an .doc as vector SVG graphic, then this is cross-browser compatible. In fact this sound so cool I'll have to try this myself as proof-of-concept.

http://www.verydoc.com/doc-to-any/word-to-svg.html
 
... or to go kind in the opposite direction (from SVG), you could rip out the text from the .doc using something like Apache POI, turn it into HTML or some other text-oriented format, and display it in any browser ...
 
... or to go kind in the opposite direction (from SVG), you could rip out the text from the .doc using something like Apache POI, turn it into HTML or some other text-oriented format, and display it in any browser ...

That was my first thought .doc-->.html by using LiberOffice in combination with unoconv which can be done from the command line. How easy is it implement Apache POI with OpenEdge?
 
We run POI through a separate OS process, eg. our OE code launches a new process a-la command line and then the user can pick it up using Apache (eg. outside of OE). I'm sure you could write something with sockets or Web Services to wrap POI, but that's way overkill for us.

We use POI to generate Excel and it works OK. It's pretty intolerant of non-A-Z characters, though, and fair enough, but when it finds a character it doesn't like, you get the typical 25 pages of Java stack trace with no useful information in it other than it failed.

(disclaimer: I am perpetually in awe of the awesomeness of FOSS in general and Apache in particular)
 
Back
Top