Microsoft.Office.Interop.Word.Application WordApp = new ApplicationClass ()
Word Object
2, Microsoft.Office.Interop.Word.Document WordDoc = WORDAPP.DOCUMENTS.ADD (ref nothing, ref no, ref nothing, ref Noth ing) Document Object
3, Object nothing = System.Reflection.Missing.Value a common parameter
4, WordApp.ActiveWindow.ActivePane.View.SeekView = WdSeekView.
wdSeekCurrentPageHeader positioning to Header
5, WordApp.Selection.ParagraphFormat. Borders[wdbordertype.wdborderbottom]
. LineStyle = Wdlinestyle.wdlinestylenone Remove header line
6, WordApp.ActiveWindow.View.SeekView = Wdseekview.wdseekmaindocument jump out of the header
7, wordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.
wdAlignParagraphCenter Alignment (this is centered)
8, Microsoft.Office.Interop.Word.Table policytab = WordDoc.Tables.Add
(WordApp.Selection.Range, number of rows, columns, ref nothing, ref nothing); Create a table
9, WordApp.Selection.GoTo (ref ogotoitem, ref ogotolast, ref nothing, ref anything); Locate the page (this is the end of the cursor positioned to the content)
10, WordApp.Selection.InsertBreak (ref nothing); Insert Section break
11, WordApp.Selection.InsertFile (Nofile, ref nothing, ref contenfalse, ref contenfalse, ref contenfalse); Insert File
12, WordApp.Selection.InlineShapes.AddPicture (Picname, ref linktofile, ref savewithdocument, ref nothing); Insert Picture
13, WordApp.ActiveWindow.ActivePane.View.SeekView = WdSeekView.
wdSeekCurrentPageFooter; Navigate to Footer
14, WordApp.Selection.TypeText ("Write the text you need to output at the specified location"); text input
15, Worddoc.computestatistics (Wdstatistic.wdstatisticpages, ref nothing); Get page number
16, Worddoc.printout (ref nothing, ref no, ref nothing, ref nothing,
Ref nothing, ref nothing, ref nothing, ref nothing,
Ref nothing, ref nothing, ref nothing, ref nothing,
Ref nothing, ref nothing, ref nothing,
Ref nothing, ref no, ref nothing);
Call printer implementation to print (call default printer)
17, Worddoc.close (ref saveChanges, ref nothing, ref nothing); Document exit
18, Wordapp.quit (ref nothing, ref nothing, ref nothing); Word program exits
C # Some basic ways to manipulate word (Word print, insert file, insert Picture, Position header footer, remove horizontal line)