Reputation: 21
I need to be able to view a file (.doc, docx, .pdf, .txt,.....ect) in the System.Windows.Forms.WebBrowser (C# Visual Studio 2008) on a system that does not have office installed on it. How do I do that? Can it be done? I viewed many of the documentation that are out there regarding this and most all have office installed already. I just need to be able to preview the documents, not modify them.
Upvotes: 2
Views: 1422
Reputation: 60021
No, you can't do this using just the WebBrowser.
If you've seen the WebBrowser open a Word doc before, it's because Office was installed on the system, and it was using the Office ActiveX control to view it.
Some alteratives:
Programmatically upload the document to Office Live, then navigate the web browser to it. Office Live now has "Word in a web browser" functionality, check it out here.
Upvotes: 2
Reputation: 161783
You can't do this in general. The way a browser displays an Office Document (or any other kind of document) is to run the application that created it - in this case, Office.
There are various tools which can render Office documents as HTML. You may be able to use those. One that I see mentioned frequently is Aspose, though I have not used it.
Upvotes: 2