We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Get all comments from a word doc

i am trying to get all comments out of the document and iterate trough the top items to fetch the replies to each top element

i am using this code , but it will not return all the comments in the document

Document doc = new Document(file);
var result = new List();
NodeCollection comments = doc.GetChildNodes(NodeType.Comment, true);
// Look through all comments and gather information about them.
foreach (Comment comment in comments.Where(c => ((Comment)c).Ancestor == null))
{
result.Add(ConvertComment(file,comment)); //fetches the replies on this comment and construct 1 element.
}

what am i missing?

@nexxbiz

The Comment.Replies property returns a collection of Comment objects that are immediate children of the specified comment. Please refer to the following article.
How to Read Comment’s Reply

i know, and i have read the article… But in my case i don’t get all the comments. And the command doc.GetChildNodes(NodeType.Comment, true); should not return only all direct children but also all deeply nested comments.

but this command doc.GetChildNodes(NodeType.Comment, true); doesn’t return all comments.

@nexxbiz

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please share the problematic output.
  • Please share the expected output.
  • Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.