日期:2014-05-17  浏览次数:21041 次

C#操作word,控制页脚问题
//设置页脚
                        appWordE.ActiveWindow.View.SeekView = WdSeekView.wdSeekCurrentPageFooter;
                        appWordE.Selection.HeaderFooter.LinkToPrevious = false;
                        appWordE.Selection.HeaderFooter.Range.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter;
                        appWordE.ActiveWindow.ActivePane.Selection.InsertAfter("中国-");

                        //跳出页眉页脚设置
                        appWordE.ActiveWindow.View.SeekView = WdSeekView.wdSeekMainDocument;



这个可以设置一个word文档的第一页,怎么能设置第二页呢?又怎么能把所有的页都设置呢?
在网上也找了,没找到。
谢谢了。
c# 文档 word 页脚

------解决方案--------------------
用appsoe.Word for Net 组件,不需要安装office组件
插入一页  
                Document doc = new Document("c://4add.doc");
                DocumentBuilder builder = new DocumentBuilder(doc);
                builder.PageSetup.DifferentFirstPageHeaderFooter = true;
                builder.PageSetup.OddAndEvenPagesHeaderFooter = true;

                // Create three pages in the document.
                builder.MoveToSection(0);
                builder.Writeln("Page1");
                builder.InsertBreak(BreakType.PageBreak);

参考http://blog.csdn.net/dfcj1010/article/details/6164947
------解决方案--------------------
Aspose 组件,貌似楼上写错了。