Reputation: 172
Please, read the entire post, it's not a simple NullReferenceException problem :
I'm trying to open a word document to write some informations on it using NetOffice.
The problem is that I get à NullReferenceException everytime I try to do it.
here is the code :
using (NetOffice.WordApi.Application app = new NetOffice.WordApi.Application())
{
NetOffice.WordApi.Document doc = app.Documents.Open(chemin);
NetOffice.WordApi.Sections sec = doc.Sections;
//etc...
}
the instruction doc.Sections throw the exception, I think it's a permission issue while opening the document (whereas I granted full access to ASP.NET, NETWORK SERVICE, and LOCAL SERVICE)
thanks for attention
EDIT : I think of a permission issue because it works localy but not in production server (I'm administrator of our network, so when I'm using the application, I can access everything, but it's not the case of IIS). Don't duplicate it, it's not only a NullReferenceException problem 'cause the code seems correct
Upvotes: 1
Views: 551
Reputation: 172
I solved the problem, in fact, that wasn't a folder permission that was missing, but word application itself blocked word editing for the user that run the website, her is the method :
https://forums.asp.net/t/1902899.aspx?Cannot+open+a+Word+doc
Upvotes: 2