Free Support Forum - aspose.com

Removing all comments from a document

I would like to remove all comments from a word document using Aspose, could you give me an example of how I could do that?

Thanks

Hi

Thanks for your inquiry. You can try using the following code.

//Open the document

Document doc = new Document(@"Test051\in.doc");

//Get collection of comments

NodeCollection comments = doc.GetChildNodes(NodeType.Comment, true);

//Remove comments

comments.Clear();

//Save document

doc.Save(@"Test051\out.doc");

I hope this could help you.

Best regards.

perfect, thank you!