Recently because of the project needs, wrote a lot of word2003 programming dongdong. Sometimes encountered problems to check the SDK instructions, it is difficult to find Chinese explanation, for e-wen is not good for me, it is a heavenly book. Presumably many people have regrets.
The following is a list of some commonly used content descriptions that are helpful to everyone.
Let's get started. Note that the following wapp is a Word document engineering variable that I define
Of
Merging cells
Table. Cell (2, 2). Merge (table. Cell (2, 3));
Cell separation
Object rownum = 2;
Object columnnum = 2;
Table. Cell (2, 2). Split (ref rownum, ref columnnum);
Cell alignment
WApp.Selection.Cells.VerticalAlignment = Microsoft.Office.Interop.Word.WdCellVerticalAlignment.wdCellAlignVerticalCenter;
Insert Table row
Table. Rows.Add (ref missing);
Pagination Object IB = Microsoft.Office.Interop.Word.WdBreakType.wdPageBreak;
WApp.Selection.InsertBreak (ref IB);
Line Wrap
WApp.Selection.TypeParagraph ();
Second, Word document settings
WApp.ActiveDocument.PageSetup.LineNumbering.Active = 0; Line number
WApp.ActiveDocument.PageSetup.Orientation = Microsoft.Office.Interop.Word.WdOrientation.wdOrientPortrait; Page orientation
WApp.ActiveDocument.PageSetup.TopMargin = wapp.centimeterstopoints (float. Parse ("2.54")); Top margin
WApp.ActiveDocument.PageSetup.BottomMargin = wapp.centimeterstopoints (float. Parse ("2.54")); Next page margin
WApp.ActiveDocument.PageSetup.LeftMargin = wapp.centimeterstopoints (float. Parse ("3.17")); Left margins
WApp.ActiveDocument.PageSetup.RightMargin = wapp.centimeterstopoints (float. Parse ("3.17")); Right margin
WApp.ActiveDocument.PageSetup.Gutter = wapp.centimeterstopoints (float. Parse ("0")); Gutter position
WApp.ActiveDocument.PageSetup.HeaderDistance = wapp.centimeterstopoints (float. Parse ("1.5")); Header
WApp.ActiveDocument.PageSetup.FooterDistance = wapp.centimeterstopoints (float. Parse ("1.75")); Footer
WApp.ActiveDocument.PageSetup.PageWidth = wapp.centimeterstopoints (float. Parse ("21")); Paper width