Aspose.words for java 16.4.0,替换内容控件中的内容报错:The reference node is not a child of this node
但是其他位置的数据替换正常,我如何在 16.4.0 的版本中兼容解决这种错误。
input.docx (24.3 KB)
public static void main(String[] args) throws Exception {
String filename1 = "D:\\input.docx";
String filename2 = "D:\\output.docx";
Document document = new Document(filename1);
BookmarkCollection bookmarkList = document.getRange().getBookmarks();
for (Bookmark bookmark : bookmarkList) {
if (bookmark.getName().contains("PO_")) {
System.out.println(bookmark.getName());
bookmark.setText(" ");
}
}
document.save(filename2);
}