Problem while opening MS-Word files using APIs
-
Hi, I am facing problem of COMException while opening MS-Word files using on
Windows Server 2003. I am refering Interop.Word.dll for opening MS-Word files to count the
number of words from it. I am using following API to open the doc files.Word.ApplicationClass wordApp = null;
Word.Document aDoc = null;
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,
ref missing, ref missing, ref missing, ref missing);
aDoc.Activate();If I deploy above code on
Windows 2000 professional then it works without error but if I deploy same code on Windows Server 2003 then I get following exception.System.Runtime.InteropServices.COMException (0x800A1066): Command failed at
Word.Documents.Open(Object& FileName, Object& ConfirmConversions, Object& ReadOnly, Object& AddToRecentFiles,
Object& PasswordDocument, Object& PasswordTemplate, Object& Revert, Object& WritePasswordDocument,
Object& WritePasswordTemplate, Object& Format, Object& Encoding, Object& Visible,
Object& OpenAndRepair, Object& DocumentDirection, Object& NoEncodingDialog, Object& XMLTransform)Please tell me solution for it. -- modified at 2:43 Saturday 19th May, 2007
#Abhi#
-
Hi, I am facing problem of COMException while opening MS-Word files using on
Windows Server 2003. I am refering Interop.Word.dll for opening MS-Word files to count the
number of words from it. I am using following API to open the doc files.Word.ApplicationClass wordApp = null;
Word.Document aDoc = null;
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,
ref missing, ref missing, ref missing, ref missing);
aDoc.Activate();If I deploy above code on
Windows 2000 professional then it works without error but if I deploy same code on Windows Server 2003 then I get following exception.System.Runtime.InteropServices.COMException (0x800A1066): Command failed at
Word.Documents.Open(Object& FileName, Object& ConfirmConversions, Object& ReadOnly, Object& AddToRecentFiles,
Object& PasswordDocument, Object& PasswordTemplate, Object& Revert, Object& WritePasswordDocument,
Object& WritePasswordTemplate, Object& Format, Object& Encoding, Object& Visible,
Object& OpenAndRepair, Object& DocumentDirection, Object& NoEncodingDialog, Object& XMLTransform)Please tell me solution for it. -- modified at 2:43 Saturday 19th May, 2007
#Abhi#
Dear Abhi Have u refer microsoft.office 11.0 library ? if not then refer it and then try on win server2003 best regards, koolprasad2003:)
Be A Good S/W Eng... Life is swing with you..Enjoy..