Last post Feb 16, 2009 08:01 AM by karthipec_gmail
Feb 15, 2009 01:14 PM|Joseph Baggett|LINK
I have a requirement to read an existing word document, whether it be old 2003 or 2007 from the web server, but don't have it open up to the users. I need to be able to somehow read the document, and parse it into html to be displayed to users so users
cannot merely just save word documents.
Any idea on how this can be done? Any components anyone suggests to use possibly?
Feb 16, 2009 08:01 AM|karthipec_gmail|LINK
You can convert the document file to html by opening it with MS Word and saving it as html. That way you would do the conversion. Use window.open in the clientside to open up the html file in new window thereby showing only HTML content.
However there are serious things to be noted before you begin:
1. You cannot instantiate MS Word COM object just like that in Asp.Net. There are a lot of security/licensing issues. An alternative is to do the same action using a .Net Console application and save the HTML files in a pre defined folder and use them from
your Asp.Net code.
2. The HTML version of Doc generated by doing a "Save As" operation is backward compatible, meaning the user downloading it can open it using MS Word and save as a word doc. If you don't want to allow this, you need to parse the HTML text and remove all un-necessary
markup added by Word.