How to display word file in browser using MVC4 .
I have a link(word file name) in my page when i click that link it should display data in browser.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kyle StoryPosted Dec 2, 2014, 5:57 AM
FileResult will not display the content of your Word file to a client, it is a download execution. What you need is to change the document's content into something appropriate for a browser (so that he can display it). For example you could convert your Word document to a HTML file in C# like the following:
The code comes from this .NET component designed for Word documents, also just to add in a case you do actually want a download rather then a display than take a look at this article that shows how you can export your Word document in ASP.NET (note that it works for MVC as well in a same manner).
Pradeep ShetPosted Jul 16, 2014, 1:29 PM
Shweta LodhaPosted Jul 16, 2014, 7:53 AM
Here are some useful links. Please have a look:
http://www.c-sharpcorner.com/forums/thread/153951/opening-worddoc2007-inside-webbrowserc-sharp-net.aspx
http://www.dotnetspider.com/resources/44302-How-show-Microsoft-Word-Document-content-browser-using-ASP.NET.aspx
http://www.aspsnippets.com/Articles/Display-Word-document-on-web-page-in-ASP.Net.aspx
http://forums.asp.net/t/1599094.aspx