Extract or Remove Comments using Aspose Java

Dear Aspose Support:
Do you have sample code for ‘Extract or Remove Comments’ using Aspose java? Thanks.
Ligong

This message was posted using Page2Forum from How-to: Extract or Remove Comments - Aspose.Words for .NET and Java

Hi

Thanks for your inquiry. Here is simple code, which shows how to get all comments from the document and remove them;

// Open document.
Document doc = new Document("C:\\Temp\\in.doc");
// Get all comments.
NodeCollection comments = doc.getChildNodes(NodeType.COMMENT, true);
// Remove all comments.
comments.clear();
// Save output document.
doc.save("C:\\Temp\\out.doc");

Hope this helps.
Best regards.