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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Shweta LodhaRank #31 · 39.8K reputationPosted Jul 16, 2014, 3:53 AM EDT
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
Pradeep ShetRank #595 · 4K reputationPosted Jul 16, 2014, 9:29 AM EDT
Kyle Story24 reputationPosted Dec 2, 2014, 12:57 AM EST
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).