Click here to Skip to main content
13,552,161 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi..
this code is working fine i use it on visual studio for opening a word file but while using on iis it shows error ' Object reference not set to an instance of an object'..Please suggest me this file path problem or some thing else

Microsoft.Office.Interop.Word.ApplicationClass WordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
                      object fileName = Server.MapPath("~/Uploadhtml/" + docname);
                      object readOnly = false;

                      object isVisible = true;
                      object missing = System.Reflection.Missing.Value;
                      WordApp.Visible = true;

                      Microsoft.Office.Interop.Word.Document aDoc = WordApp.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);

                      aDoc.Activate();
Posted 23-Aug-12 20:42pm
Updated 1-Jan-18 23:22pm
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Check your file path and location.
I guess Server.MapPath("~/Uploadhtml/" + docname); is where you need to fix the issue.
  Permalink  
Comments
ridoy 24-Aug-12 3:05am
   
right
atul tr 24-Aug-12 3:11am
   
can u tell me what to do Uploadhtml is a folger which is inside of my application .is there any other correct way to give the path

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web04 | 2.8.180515.1 | Last Updated 2 Jan 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100