How to add comment to footnote text

Hello

Can you please tell me how to add a comment to a matched text (via a Replace) in a FOOTNOTE? I can add comments to specific words in the MAIN PART of a page with the following code, but just not a footnote:

var comment = new Comment(matchNode.Document, "Me", "Me", DateTime.Today);
comment.SetText("This is my comment");

// Create start and end ranges for the comment
var commentRangeStart = new CommentRangeStart(matchNode.Document, comment.Id);
var commentRangeEnd = new CommentRangeEnd(matchNode.Document, comment.Id);

// Set start and end ranges at relevant locations
matchNode.ParentNode.InsertBefore(commentRangeStart, (Node)runs[0]);
matchNode.ParentNode.InsertAfter(commentRangeEnd, (Node)runs[runs.Count - 1]);

// Insert comment
commentRangeEnd.ParentNode.InsertAfter(comment, commentRangeEnd);

However it does not work if the matched text is in a footnote.

Any help would be much appreciated. Thank you! :slight_smile:

@ast3,

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

  • Your input Word document
  • Your expected Word document showing the correct output. Please create this document by using MS Word.

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

Hi Awais,

Thanks for your reply. I tried creating the expected output in Word, and I discovered that - to my surprise - word does not support comments in footnotes!

So that solves the mystery :slight_smile: I will have to add comment to the footnote reference number in the main text.

Thanks

@ast3,

Thanks for the information. Please let us know any time you have any further queries.