Answered by:
Open a word file in ASP.NET

Question
-
User356536936 posted
I have a MS Word document saved in the web server and I want to open it without MS Office Interop, from my web page.
What is the best possible way to achieve it?
Wednesday, April 14, 2010 7:55 PM
Answers
-
User377791177 posted
Opening only shouldn't be a big deal, all you've to do is to make your Response understand that you are going to send a word file. i.e.
Response.Clear();
Response.AddHeader("content-disposition", "attachment;
filename=Yourfile.doc);Response.Charset = "";
Response.ContentType = "application/ms-word";
Response.WriteFile(Server.MapPath("file path"));
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, April 19, 2010 5:58 AM
All replies
-
User-1636183269 posted
http://bytes.com/topic/asp-net/answers/520496-how-open-word-document-asp-net-c
Wednesday, April 14, 2010 9:20 PM -
User-1636183269 posted
http://www.vbdotnetheaven.com/Uploadfile/mgold/WordDocument04182005081441AM/WordDocument.aspx
Open in Server control: http://forums.asp.net/t/1514102.aspx
Mark as answer if it helps.
Wednesday, April 14, 2010 9:21 PM -
User356536936 posted
I can't use any word com/dll
Wednesday, April 14, 2010 10:07 PM -
User-1267218547 posted
HI sudiptakr ,
As far as I know, if you don't want to use any word com/dll, you can try to use the Office Open XML.
http://en.wikipedia.org/wiki/Office_Open_XML
http://msdn.microsoft.com/en-us/library/aa338205.aspx
But it applies to 2007, if it is word2003, you must use the word com for reading the word content.
I hope it is helpful to you.
Monday, April 19, 2010 4:55 AM -
User-1200560727 posted
Please go through below links:
http://forums.asp.net/t/1516308.aspx
http://msdn.microsoft.com/en-us/library/aa163987%28office.10%29.aspx
http://www.daniweb.com/forums/thread74410.html#
I hope it will helpful to you.
Regards,
TapanMonday, April 19, 2010 5:23 AM -
User-1199946673 posted
if it is word2003, you must use the word com for reading the word contentI really can't believe that a MSFT would give such advise!
"Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment."
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2
And what about the license, does Microsoft allow to install this on a webserver?
Monday, April 19, 2010 5:49 AM -
User377791177 posted
Opening only shouldn't be a big deal, all you've to do is to make your Response understand that you are going to send a word file. i.e.
Response.Clear();
Response.AddHeader("content-disposition", "attachment;
filename=Yourfile.doc);Response.Charset = "";
Response.ContentType = "application/ms-word";
Response.WriteFile(Server.MapPath("file path"));
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, April 19, 2010 5:58 AM -
User-37275327 posted
try this
http://www.aspose.com/
Monday, April 19, 2010 8:03 AM -
User-1267218547 posted
Hi hans_v,
if it is word2003, you must use the word com for reading the word contentI really can't believe that a MSFT would give such advise!
I am sorry for my ignorant and mistake.
Please give your good idea and solution.
Thanks!
Monday, April 19, 2010 10:40 PM -
User-1199946673 posted
Please give your good idea and solutionThe answer is already been given. Use third party tools like Aspose
Tuesday, April 20, 2010 3:09 AM -
User1364706731 posted
Refer this link
http://www.c-sharpcorner.com/UploadFile/mgold/WordFromDotNet11082005235506PM/WordFromDotNet.aspx
Tuesday, April 20, 2010 6:50 AM -
User-1199946673 posted
Refer this link
http://www.c-sharpcorner.com/UploadFile/mgold/WordFromDotNet11082005235506PM/WordFromDotNet.aspx
Like many other solutions in this topic, this example also uses Microsoft Office Interop, which is exactly what the topic opener (very wisely) doesn't want to use:
and I want to open it without MS Office InteropTuesday, April 20, 2010 8:40 AM -
User356536936 posted
If I have to use any third party tool or MS component then I would not have posted here..
Thanks SHASHANK, It's working for me..
Tuesday, April 20, 2010 10:56 PM