省略numpages aspose .net上的最后一页
我正在寻找Aspose .NET中的解决方案以减少数字。原因是我不想计算文档的最后一页。这是我到目前为止尝试的:
builder.Write("Page ");
builder.InsertField("Page", "");
builder.Write(" of ");
builder.InsertField("NUMPAGES", $"{(doc.PageCount - 1)}");
// Another try in separate build
builder.InsertField("NUMPAGES - 1", "");
// Another try in separate build
builder.InsertField("NUMPAGES", "NUMPAGES - 1");
文档要么没有显示任何内容,要么也计算最后一页。
I'm looking for a solution in ASPOSE .Net to decrement the NUMPAGES. Reason is that I don't want to count the last page of the document. Here is what I tried so far:
builder.Write("Page ");
builder.InsertField("Page", "");
builder.Write(" of ");
builder.InsertField("NUMPAGES", quot;{(doc.PageCount - 1)}");
// Another try in separate build
builder.InsertField("NUMPAGES - 1", "");
// Another try in separate build
builder.InsertField("NUMPAGES", "NUMPAGES - 1");
Document either doesn't display anything or count the last page as well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该使用公式和嵌套数字字段来获取所需的输出。您的MS Word文档中的字段代码应该看起来像:
{= {numpages} -1}
。要使用aspose.words插入此类字段。您可以使用这样的代码:请参阅Aspose.words文档以学习如何使用字段。
You should use formula and nested NUMPAGES field to get the desired output. Field code in your MS Word document should look like this:
{={NUMPAGES}-1}
. To insert such field using Aspose.Words you can use code like this:Please see Aspose.Words documentation to learn how to work with fields.