您好,
感谢您的咨询。
如果你是想直接获取页码,目前我们的产品还没有页这个概念,因此您的获取页码的需求暂时无法满足。但我们已将它作为新功能添加到我们产品的升级列表,编号:SPIREDOC-7515, 这个新功能一旦实现,我们将会第一时间通知您。
如果你想在在文档中显示页码,可以通过页码域进行设置,请参考以下代码:
- Code: Select all
Document document =new Document();
document.loadFromFile("test.docx");
Section lastSection = document.getLastSection();
Paragraph paragraph = lastSection.addParagraph();
Field field = paragraph.appendField("pageRef", FieldType.Field_Page_Ref);
field.setCode("PAGEREF bookmark1 \\# \"0\" \\* Arabic \\* MERGEFORMAT");
document.isUpdateFields(true);
document.saveToFile("out.docx",FileFormat.Docx);
Sincerely,
Triste
E-iceblue support team