JonnyPoet
March 19th, 2009, 09:04 AM
I have the following codetry {
//try to open the document
docRef = wordApp.Documents.Open( ref file, 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);
wordApp.Visible = false;
// some actions done like
docRef.ActiveWindow.Selection.WholeStory();
docRef.ActiveWindow.Selection.Copy();
IDataObject data = Clipboard.GetDataObject();
_rtbDoc.Paste();
//...
} catch (Exception ex) {
throw ex;
}
finally{
object boolObj = (object)false;
docRef.Close(ref boolObj, ref boolObj, ref boolObj);
wordApp.Quit(ref boolObj, ref boolObj, ref boolObj);
}
The read shows lines both give me a warning which translated from german is still strange as I dont know how to handle that it says
Multisignificance between
Microsoft.Office.Interop.Word._Document.Close(ref object, ref object, ref object)-Method and the 'non method '"Microsoft.Office.Interop.Word.DocumentEvents2_Event.Close". A methodgroup is used verwendet. ( pointing to the line where I do docRef.Close(....) )
The other one is
Multisignificance between Microsoft.Office.Interop.Word._Application.Quit(ref object, ref object, ref object)-Method and the non method "Microsoft.Office.Interop.Word.ApplicationEvents4_Event.Quit". A methodgroup is used. ( This points to the line where I use wordApp.Quit(...)
But the program itself seems to work properly. But there can occure some events where I found out that WinWord.Exe in the Taskmanager still hangs around so I want to find out what this erromessage should be and how to get a reliable method to close my hidden called word application, because I have seen if it wasn't correctly closed by my application it can create problems when my code is trying to open another document with the same method.
//try to open the document
docRef = wordApp.Documents.Open( ref file, 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);
wordApp.Visible = false;
// some actions done like
docRef.ActiveWindow.Selection.WholeStory();
docRef.ActiveWindow.Selection.Copy();
IDataObject data = Clipboard.GetDataObject();
_rtbDoc.Paste();
//...
} catch (Exception ex) {
throw ex;
}
finally{
object boolObj = (object)false;
docRef.Close(ref boolObj, ref boolObj, ref boolObj);
wordApp.Quit(ref boolObj, ref boolObj, ref boolObj);
}
The read shows lines both give me a warning which translated from german is still strange as I dont know how to handle that it says
Multisignificance between
Microsoft.Office.Interop.Word._Document.Close(ref object, ref object, ref object)-Method and the 'non method '"Microsoft.Office.Interop.Word.DocumentEvents2_Event.Close". A methodgroup is used verwendet. ( pointing to the line where I do docRef.Close(....) )
The other one is
Multisignificance between Microsoft.Office.Interop.Word._Application.Quit(ref object, ref object, ref object)-Method and the non method "Microsoft.Office.Interop.Word.ApplicationEvents4_Event.Quit". A methodgroup is used. ( This points to the line where I use wordApp.Quit(...)
But the program itself seems to work properly. But there can occure some events where I found out that WinWord.Exe in the Taskmanager still hangs around so I want to find out what this erromessage should be and how to get a reliable method to close my hidden called word application, because I have seen if it wasn't correctly closed by my application it can create problems when my code is trying to open another document with the same method.