aspose.words 页脚如何添加"第页,共页"(*是数字)?
您可以使用下面的C#代码Aspose.Words for .NET在Word文档的页脚中插入PAGE和NUMPAGES字段:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("first page");
builder.InsertBreak(BreakType.PageBreak);
builder.Writeln("other page");
builder.InsertBreak(BreakType.PageBreak);
builder.Writeln("last page");
PageSetup ps = builder.PageSetup;
builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);
builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;
builder.Write("Page ");
builder.InsertField("PAGE");
builder.Write(" of ");
builder.InsertField("NUMPAGES");
doc.Save("C:\\temp\\20.11.docx");