Documents.Open returns null, running Word automation under ASP.NET on x64

When building an ASPapplication that generates Word documents,  it was working fine on the local machine. A windows XP installation with Office 2007. When we deployed it to windows 2008 (64 bit) and Word 2007 we saw that Documents.Open returned null. Other than this, there are no exceptions.

The code that returned the error (simplified):

Application app = new Application();
Document doc = app.Documents.Open(ref name);

As it turns out, a 64 bit system stores temporary files in "C:\Windows\SysWOW64\config\systemprofile\Desktop" folder.

The solution: create a new directory called "Desktop" inside "C:\Windows\SysWOW64\config\systemprofile\"

Hope this helps.

Published Thu, Feb 2 2012 5:53 AM by Rick van den Bosch

Comments

# re: Documents.Open returns null, running Word automation under ASP.NET on x64

THANKS,

grock

Monday, February 20, 2012 1:34 PM by GRock

# re: Documents.Open returns null, running Word automation under ASP.NET on x64

Thank you Rick. Helps me a lot when integrating word automation in reporting services 2008 R2

Wednesday, May 02, 2012 2:05 PM by stefan

# re: Documents.Open returns null, running Word automation under ASP.NET on x64

Great blog.

Monday, May 28, 2012 6:45 AM by santa

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Please add 8 and 8 and type the answer here: