Extract or Remove Comments using Aspose Java

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

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


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.
// Save output document.

Hope this helps.
Best regards.