Kavaliou
Kavaliou

Reputation: 63

Microsoft.Office.Interop.Word.Application.Documents.Open("C:\\doc.doc") not open

When i trying to open the document (.doc or .docx) instance of document is NULL.

Application wordApplication = new Application();
wordApplication.Visible = false;
Document wordDocument =  wordApplication.Documents.Open("C:\\doc.doc");

And why is wordApplication.Documents.Count equal of zero?

(Windows Server 2008 R2 x64, MS Office 2010 x64)

Upvotes: 3

Views: 16419

Answers (1)

alex.b
alex.b

Reputation: 4567

This helped me several years ago.

Inlined

There are several suggested answers, I tried the second one and it solved my problem. But I'm inlining all of them here/.

1-st approach: try to create a new "Desktop" directory inside of "C:\Windows\SysWOW64\config\systemprofile\"

2-nd: you must change the identity of word component in windows\System32\comexp.msc to be interactive user instead of launching user.

3-rd:
0. Set the DCOM Config Setting for "Microsoft Office Word 97 - 2003 Document"
(Open the properties > Identity Tab > Select "The interative User" Secutiry Tab > Lanuch and Acctivation Permissions > Add Network Serivce

  1. Save the settings
  2. Open your Virtual directory in IIS
  3. Select the Virtual directory
  4. Select "Authentication".
  5. Edit anonymous authentication
  6. Dialog box will get opened > click on set > admin user (any admin user is good)

Upvotes: 6

Related Questions