日期:2014-05-18 浏览次数:20964 次
if (WordApp.ActiveWindow.ActivePane.View.Type == WdViewType.wdNormalView || WordApp.ActiveWindow.ActivePane.View.Type == WdViewType.wdOutlineView)
{
WordApp.ActiveWindow.ActivePane.View.Type = WdViewType.wdPrintView;
}
WordApp.ActiveWindow.View.SeekView = WdSeekView.wdSeekPrimaryFooter;
object objATEntry_Page = "第 X 页 共 Y 页";
WordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter;//设置居中齐
object objTrue = true;
Range rng = WordApp.Selection.HeaderFooter.Range;
WordApp.NormalTemplate.AutoTextEntries.get_Item(ref objATEntry_Page).Insert(rng, ref objTrue);
WordApp.Selection.HeaderFooter.Range.InsertBefore(sFooter);
WordApp.ActiveWindow.ActivePane.View.SeekView = WdSeekView.wdSeekMainDocument;