公共静态无效AddNumeration(参考WordprocessingDocument finalDoc){
IEnumerable<FooterPart> foo = finalDoc.MainDocumentPart.FooterParts;
int count = 1;
foreach (FooterPart fp in foo){
Footer f = new Footer();
ParagraphProperties paragraphProperties1 = new ParagraphProperties(new SectionProperties(new PageNumberType { Start = 1 }));
paragraphProperties1.NumberingProperties = NumberingProperties
paragraphProperties1.Justification = new Justification() { Val = JustificationValues.Right };
Run run1 = new Run();
Text text1 = new Text();
text1.Text = count.ToString();
count++;
run1.Append(text1);
Paragraph paragraph1 = new Paragraph() { RsidParagraphAddition = "00164C17", RsidRunAdditionDefault = "00164C17" };
paragraph1.Append(paragraphProperties1);
paragraph1.Append(run1);
f.Append(paragraph1);
fp.Footer = f;
}
}
此代码始终在每页的页脚部分显示数字 1。