Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am writing a webservice in C#.Net. I added the reference to Microsoft.Office.Interop.Word. When I attempt to do Documents.Open, I get the following error:

 

Can someone pleease help.

Thanks

Guha

 

Error

System.Runtime.InteropServices.COMException (0x800A1066): Command failed

 

The Code:

strWordTemplateFile = Server.MapPath(AppSettings.SupportingDocumentsLocation + "/LicenseOrderConfirmation.doc");

strWordDocumentFile = "c:\\temp\\LicenseOrderConfirmation.doc";

objWordDocumentFile = "c:\\temp\\LicenseOrderConfirmation.doc";

 

Microsoft.Office.Interop.Word.ApplicationClass objWord = new Microsoft.Office.Interop.Word.ApplicationClass();

 

System.IO.File.Copy(strWordTemplateFile,strWordDocumentFile,true);

object objVisible = false;

objWord.Visible = false;

objWord.Documents.Open(ref objWordDocumentFile,ref missing, ref missing, ref missing,ref missing,

ref missing,ref missing, ref missing, ref missing, ref missing, ref missing,

ref objVisible,ref missing,ref missing, ref missing, ref missing);

Posted

Office applications are simply not made to be run on a server...

This could be a permissions issue, or it could be an unfixable problem with automating Word on a server. I've seen this problem mentioned before, but never seen a solution being proposed.

 

Articles that you should read:

INFO: Considerations for Server-Side Automation of Office

How To Configure Office Applications for Automation from a COM+/MTS Package

How to configure Office applications to run under a specific user account

How to configure Office applications to run under the interactive user account

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...