المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Getting an Exception : (HRESULT: 0x800A140C ) while trying to close Word 2k10 Document



C# Programming
11-20-2010, 05:00 AM
Hi all,

I have tried to open an existing Word 2k10 document in mail merge format.
private object tArg = true;
private object fArg = false;
private object wOriginalFormat = Microsoft.Office.Interop.Word.WdOriginalFormat.wdOriginalDocumentFormat;

sourceDoc = word.Documents.Open(ref oSourceFile,//1The name of the document (paths are accepted).
ref mArg,//2True to display the Convert File dialog box if the file isn't in Microsoft Word format.
ref mArg,//3True to open the document as read-only.
ref mArg,//4True to add the file name to the list of recently used files at the bottom of the File menu.
ref mArg,//5The password for opening the document.
ref mArg,//6The password for opening the template.
ref mArg,//7Controls what happens if FileName is the name of an open document. True to discard any unsaved changes to the open document and reopen the file. False to activate the open document.
ref mArg,//8The password for saving changes to the document.
ref mArg,//9The password for saving changes to the template.
ref wdOpenFormatAllWord,//10The file converter to be used to open the document. Can be one of the following WdOpenFormat constants
ref fArg,//11The document encoding (code page or character set) to be used by Microsoft Word when you view the saved document.
ref mArg,//12True if the document is opened in a visible ******** The default value is True.
ref mArg,//13Specifies whether to open the conflict file for a document with an offline conflict.
ref mArg,//14True to repair the document to prevent document corruption.
ref mArg,//15True to skip displaying the Encoding dialog box that Word displays if the text encoding cannot be recognized. The default value is False.
ref mArg);//16Indicates the horizontal flow of text in a document. The default value is wdLeftToRight.

and then added some tables in it and then save it and close it using .
sourceDoc.Save();
((Microsoft.Office.Interop.Word._Document)sourceDoc).Close(ref tArg, ref wdOriginalFormat, ref fArg);

I am getting an exception on doing the close and HRESULT points to 0x800A140C. Can somebody suggest me any solution for this