Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to open a word document from Asp.net

i used the following code

object fileName = strFileName;
            object readOnly = false;
            object isVisible = true;
            object missing = System.Reflection.Missing.Value;
            oWordApplic.Visible = true;
            oDoc = oWordApplic.Documents.Open(ref fileName, ref missing, ref readOnly,
                ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
                ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing);
            oDoc.Activate();


My issue now is that everything just hangs. I can see that WORD.exe is active with the ASPNET user(By task manager), but absolutely nothing happens; the web process maybe goes 25% of the way through and then just hangs.


And if we stops the WORD.exe via task manager,then it will show "Remote Procedure Call Failed error message"

Please help me,
Posted
Updated 30-Nov-11 0:04am
v3
Comments
resonance_siv 30-Nov-11 6:06am    
while creating object i think u need to give the file path. chek it

check this link here[^]
 
Share this answer
 
See this link :

Microsoft Word Documents from ASP.NET

I hope it will help you :)
 
Share this answer
 
Not sure why you have code like this to open a word document i believe you are building a asp.net web application that the users can use remotly.

If my assumption is true even your code works on your local machine it wont work for the users when finally you will deploy it on production server as it will open the word document on server and return nothing to user.

in a client-server appilcation for a request web application must send some data as response with valid MIME type so that client browser can take appropriate action. having that said i believe you should update your code so that user can download the file i.e. open some file on clicking of soem button or link.

see below link:
http://stackoverflow.com/questions/2519026/how-do-you-stream-an-excel-2007-or-word-2007-file-using-asp-net-and-c-sharp[^]

If you are trying to edit a word doc file in your asp.net file then that is a different story.
 
Share this answer
 
You can refer this URL.........................
Microsoft Word Documents from ASP.NET[^]
 
Share this answer
 
Hi Kishore,
you can try
Process.Start("winword.exe");
it will work fine.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900