Error while opening a word file in IIS

Posted by Santosh4u under ASP.NET on 1/13/2014 | Points: 10 | Views : 957 | Status : [Member] | Replies : 2
Hi
i am working on to open a word file in popup windows and i am able to open whne i am running using visual studio but the problem is that after configuring into IIS if i am trying to open same word file from path it's throwing error that
"This command is not available because no document is open."
below is my code.

Microsoft.Office.Interop.Word.Document docs;
Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.ApplicationClass();

docs = null;
object miss = System.Reflection.Missing.Value;
// create object of selected file path
object path = @"F:\Temp1\" + "Test.doc";
// set file path mode
object readOnly = false;

ApplicationClass applicationclass = new ApplicationClass();

docs = word.Documents.Open(ref path, ref miss, ref readOnly, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss);

applicationclass.Visible = false;

Document document = word.ActiveDocument;

Note: docs variable is returning NULL means open command is not working to open the file.




Responses

Posted by: Sheonarayan on: 1/13/2014 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Most probably your application is not able to find the path, try to keep the word file in the root or roo/subfolder of your application.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Santosh4u, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Santosh4u on: 1/13/2014 [Member] Bronze | Points: 25

Up
0
Down
Hi Sheo ,
Path is correct because exactly same path i am using in visual studio it's working file but same after configured in IIS is giving issue.seems permission issue but don't find exactly problem..

Thanks
Santosh

Santosh4u, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response