C# word中插入页脚而不要页眉横线
2013-04-12 19:01
246 查看
private void InsertPageFooterNumber()
{
//插入简单页码
object oAlignment = Word.WdPageNumberAlignment.wdAlignPageNumberCenter;
object oFirstPage = true;
Word.WdHeaderFooterIndex WdFooterIndex = Word.WdHeaderFooterIndex.wdHeaderFooterPrimary;
word.Selection.Sections[1].Footers[WdFooterIndex].PageNumbers.Add(ref oAlignment, ref oFirstPage);
word.Selection.Sections[1].Footers[WdFooterIndex].Range.Font.Name = "Times New Roman";
word.Selection.Sections[1].Footers[WdFooterIndex].Range.Font.Size = 10;
word.Selection.Sections[1].Headers[WdFooterIndex].Range.ParagraphFormat.Borders[Word.WdBorderType.wdBorderBottom].LineStyle = Word.WdLineStyle.wdLineStyleNone;//这句话去掉页眉的横线
}
{
//插入简单页码
object oAlignment = Word.WdPageNumberAlignment.wdAlignPageNumberCenter;
object oFirstPage = true;
Word.WdHeaderFooterIndex WdFooterIndex = Word.WdHeaderFooterIndex.wdHeaderFooterPrimary;
word.Selection.Sections[1].Footers[WdFooterIndex].PageNumbers.Add(ref oAlignment, ref oFirstPage);
word.Selection.Sections[1].Footers[WdFooterIndex].Range.Font.Name = "Times New Roman";
word.Selection.Sections[1].Footers[WdFooterIndex].Range.Font.Size = 10;
word.Selection.Sections[1].Headers[WdFooterIndex].Range.ParagraphFormat.Borders[Word.WdBorderType.wdBorderBottom].LineStyle = Word.WdLineStyle.wdLineStyleNone;//这句话去掉页眉的横线
}
相关文章推荐
- 使用C#在word中插入页眉页脚
- 使用C#实现在word中插入页眉页脚的方法
- 在C#中实现Word页眉页脚的全部功能
- 用word 2003制作毕业论文从正文开始加页码的页眉页脚,去掉页眉横线
- word插入空白页且使得页码连续且没有页眉和页脚的方法
- C#word(2007)操作类--新建文档、添加页眉页脚、设置格式、添加文本和超链接、添加图片、表格处理、文档格式转化
- C# 替换Word文字【包含页眉、页脚、文本框、普通文字的替换】
- 在word中如何在不同的章节中插入不同的页眉、页脚
- C#操作word的一些基本方法(word打印,插入文件,插入图片,定位页眉页脚,去掉横线)
- C#操作word的一些基本方法(word打印,插入文件,插入图片,定位页眉页脚,去掉横线)
- 如何用word 2007在指定页插入页码和页眉页脚?
- 如何在WORD里面插入不同的页眉和页脚
- word 当前页插入页眉、页脚、页码。要求奇偶页眉不同,而页码连续。
- 如何用word 2007在指定页插入页码和页眉页脚?
- word 2007为不同页插入不同页眉页脚
- Word 2013中任意页插入页眉页脚的方法
- word中如何插入一页没有页眉页脚的空白页
- C#操作word的一些基本方法(word打印,插入文件,插入图片,定位页眉页脚,去掉横线)
- C# 如何给Word文档第一页设置不同的页眉和页脚
- C# 操作Word 文档——添加Word页眉、页脚和页码