code_junkie

Create a new Word Document using VSTO

Nov 11th, 2011
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. using Word = Microsoft.Office.Interop.Word;
  2.  
  3. object missing = System.Reflection.Missing.Value;
  4. Word.Application app = new Word.ApplicationClass();
  5. Word.Document doc = app.Documents.Add(ref missing, ref missing, ref missing, ref missing);
  6. doc.Activate();
  7. app.Selection.TypeText("This is some text in my new Word document.");
  8. app.Selection.TypeParagraph();
  9.  
  10. Globals.ThisAddIn.Application.Documents.Add(ref objTemplate, ref missingType, ref missingType, ref missingType);
Add Comment
Please, Sign In to add comment