What is the option to all comments in a document function?
Summary
There is no specific evidence in the provided sources that describes a built‑in “remove all comments” function for PDF or Word documents in the Aspose .NET APIs.
Why it happens
The retrieved snippets relate to an image‑extraction issue in Aspose.Words and do not mention comment handling, annotation collections, or any API method for clearing comments.
What to do next
- Consult the official Aspose.Pdf and Aspose.Words documentation for the version you are using and look for methods that manipulate the
Annotationscollection (PDF) or theCommentscollection (Word). - If a direct “clear all comments” method is not available, the typical pattern is to iterate over the relevant collection and delete each comment object, taking care not to modify the collection while iterating.
- Test the approach on a sample document and verify that comments are removed or hidden as required.
If you need concrete code examples, refer to the Aspose API reference or support forums for the exact classes and properties for the SDK version you are using.
I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.
@scottarmstrong You can use Comment.Done property to mark comment as resolved. You can use the following code to mark all comments in the document as resolved:
Document doc = new Document(@"C:\Temp\in.docx");
// Get all comments and mark them as resolved.
doc.GetChildNodes(NodeType.Comment, true).Cast<Comment>().ToList()
.ForEach(c => c.Done = true);
doc.Save(@"C:\Temp\out.docx");
Or in Java
Document doc = new Document("C:\\Temp\\in.docx");
// Get all comments and mark them as resolved.
NodeCollection comments = doc.getChildNodes(NodeType.COMMENT, true);
for (Comment c : (Iterable<Comment>) comments) {
c.setDone(true);
}
doc.save("C:\\Temp\\out.docx");