【发布时间】:2021-06-18 17:01:38
【问题描述】:
我正在使用以下代码在现有文档中添加新页面。它正在工作,但新创建的页面复制了旧页面的属性(页眉和页脚)。我想添加/附加一个没有页眉和的新页面现有文档的页脚。 请建议这里有什么问题。有没有办法获取最后一页并删除页眉和页脚
下面的代码是给this xml
Paragraph paragraph = new Paragraph();
ParagraphProperties paragraphProperties = new ParagraphProperties();
SectionProperties sectionProperties1 = new SectionProperties();
SectionType sectionType1 = new SectionType() { Val = SectionMarkValues.NextPage };
//sectionType1.Descendants<FooterReference>();
sectionProperties1.Append(sectionType1);
paragraphProperties.Append(sectionProperties1);
paragraph.Append(paragraphProperties);
mainPart.Document.Body.InsertAfter(paragraph, mainPart.Document.Body.LastChild);
【问题讨论】:
标签: c# ms-word openxml word-addins