首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

C#操作word,控制页脚有关问题

2013-03-04 
C#操作word,控制页脚问题//设置页脚appWordE.ActiveWindow.View.SeekView WdSeekView.wdSeekCurrentPage

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 组件,貌似楼上写错了。

热点排行