您好,我当前使用的aspose 版本是23.6,在对文档添加页脚的时候,SDK抛出异常:Cannot insert a node of this type at this location. 请问是什么问题导致的呢,该如何解决?
代码如下所示:
String path = “/Users/songyexiang/Desktop/test/原始.docx”;
Document document = new Document(path);
Section section = document.getSections().get(0);
HeaderFooter headerFooter = new HeaderFooter(document, HeaderFooterType.FOOTER_PRIMARY);
section.getHeadersFooters().add(headerFooter);
//将内容添加到页脚
headerFooter.appendChild(new Run(document, “Page 1”));
document.save(“/Users/songyexiang/Desktop/test/页码.docx”);
word 文档:
原始.docx (15.5 KB)