Aspose.Words for Java word转html,转换后显示了批注内容

转换后显示了批注.zip (322.2 KB)
word文件在转换后显示了批注,我并不想显示批注,请问如何解决,感谢!

1 Like

使用的转换代码如下:
Document document = new Document(sourceFileName);
HtmlFixedSaveOptions options = new HtmlFixedSaveOptions();
options.setUseTargetMachineFonts(false);
options.setUseHighQualityRendering(true);
options.setEncoding(Charset.forName(“UTF-8”));
options.setExportEmbeddedFonts(true);
options.setShowPageBorder(true);
document.acceptAllRevisions();
document.save(targetFileName, options);

@xiangma,

您可以使用以下代码首先从Word文档中删除注释,然后将其保存为HTML_Fixed格式。 希望这可以帮助。

Document doc = new Document("E:\\Temp\\206170\\in.doc");

for (Comment comment : (Iterable<Comment>) doc.getChildNodes(NodeType.COMMENT, true)){
    comment.remove();
}

HtmlFixedSaveOptions options = new HtmlFixedSaveOptions();
options.setUseTargetMachineFonts(false);
options.setUseHighQualityRendering(true);
options.setEncoding(Charset.forName("UTF-8"));
options.setExportEmbeddedFonts(true);
options.setShowPageBorder(true);
doc.acceptAllRevisions();

doc.save("E:\\Temp\\206170\\awjava-19.11.html", options);

此问题已得到解决,非常感谢!!!