Aspose.words technical query

how to get the section for which a comment is added


Thanks for your inquiry. You can use the following code to determine the Section a comment belongs to:

Document doc = new Document(MyDir + @"in.docx");
foreach(Comment comment in doc.GetChildNodes(NodeType.Comment, true))
    Section section = (Section) comment.GetAncestor(NodeType.Section);
    if (section != null)
        Console.WriteLine("Section index={0}", doc.Sections.IndexOf(section));

I hope, this helps.

Best regards,