Word 2010 automation
-
What reference assembly I need to add to achieve word automation, a week back sysadmin install office 2010 bundle. Though I do not use C# at my work. and haven't code since last 3 yrs. I am trying to code some internal utilities for team and myself. TIA
-
What reference assembly I need to add to achieve word automation, a week back sysadmin install office 2010 bundle. Though I do not use C# at my work. and haven't code since last 3 yrs. I am trying to code some internal utilities for team and myself. TIA
Microsoft.Office.Interop.Word * EDIT * Also: Here is a sample...
using Word = Microsoft.Office.Interop.Word;
Word.Application _wordApp = new Word.ApplicationClass();
object nullObj = System.Reflection.Missing.Value;
object readOnly = true;
object visible = false;
object fileName = "some file name";
object saveChanges = Word.WdSaveOptions.wdDoNotSaveChanges;Word.Document _doc = _wordApp.Documents.Open(ref fileName, ref nullObj, ref readOnly,
ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj,
ref nullObj, ref visible, ref nullObj, ref nullObj, ref nullObj, ref nullObj);
_doc.Activate();
_doc.PrintOut(ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj,
ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj,
ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj);modified on Thursday, March 17, 2011 4:32 PM
-
Microsoft.Office.Interop.Word * EDIT * Also: Here is a sample...
using Word = Microsoft.Office.Interop.Word;
Word.Application _wordApp = new Word.ApplicationClass();
object nullObj = System.Reflection.Missing.Value;
object readOnly = true;
object visible = false;
object fileName = "some file name";
object saveChanges = Word.WdSaveOptions.wdDoNotSaveChanges;Word.Document _doc = _wordApp.Documents.Open(ref fileName, ref nullObj, ref readOnly,
ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj,
ref nullObj, ref visible, ref nullObj, ref nullObj, ref nullObj, ref nullObj);
_doc.Activate();
_doc.PrintOut(ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj,
ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj,
ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj);modified on Thursday, March 17, 2011 4:32 PM
Thanks Tim, I am missing Microsoft.Office.Interop.Word in MSVC 2005, COM assembly listing.Google did not gave me any good results.
-
Thanks Tim, I am missing Microsoft.Office.Interop.Word in MSVC 2005, COM assembly listing.Google did not gave me any good results.
I'd guess you have to download them. Maybe this Google result[^] helps. :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.