OpenXML insert comment reply into word document C#
<p>I am trying to insert a comment as a reply using OpenXml. If it is not possible, I would like to insert a comment right after a selected comment. So far I am able to insert the comment in the place I want but I cannot get the comment to display when I open the document. </p>

<p>Below is the code to insert the comment. </p>

<pre><code> using (WordprocessingDocument document = WordprocessingDocument.Open(path + fileName + ".docx", true)){

            // Locate the first paragraph in the document.
            //XMLParagraphAlias firstParagraph = document.MainDocumentPart.Document.Descendants&lt;XMLParagraphAlias&gt;().First();

            XMLCommentsAlias comments = document.MainDocumentPart.WordprocessingCommentsPart.Comments;

            string id = comments.Descendants&lt;DocumentFormat.OpenXml.Wordprocessing.Comment&gt;()
                 .Where(i =&gt; i.Id.Value == reply.CurrentCommentID.ToString())
                 .Select(e =&gt; e.Id.Value)
                 .First();


             // Compose a new Comment and add it to the Comments part.
             XMLParagraphAlias p = new XMLParagraphAlias(new Run(new Text(reply.ReplyText)));

             string newCommentID = comments.Descendants&lt;DocumentFormat.OpenXml.Wordprocessing.Comment&gt;().Select(e =&gt; e.Id.Value).Max();

             XMLCommentAlias cmt = new XMLCommentAlias()
                                  {
                                    Id = newCommentID,
                                    Author = reply.CurrentUserName,
                                    Date = DateTime.Now.Date
                                  };

             XMLCommentAlias comment = comments.Elements&lt;XMLCommentAlias&gt;()
                                       .Where(n =&gt; n.Id.Value == reply.CurrentCommentID.ToString())
                                       .First();

             XMLParagraphAlias test2 = comment.Descendants&lt;XMLParagraphAlias&gt;().First();

            cmt.AppendChild(p);        
            comments.AppendChild(cmt);
            comments.Save();

            // Specify the text range for the Comment. 
            // Insert the new CommentRangeStart before the first run of paragraph.
            test2.InsertBefore(new CommentRangeStart() { Id = reply.CurrentCommentID.ToString() }, test2.GetFirstChild&lt;Run&gt;());

            // Insert the new CommentRangeEnd after last run of paragraph.
            var cmtEnd = test2.InsertAfter(new CommentRangeEnd() { Id = reply.CurrentCommentID.ToString() }, test2.Elements&lt;Run&gt;().Last());

            // Compose a run with CommentReference and insert it.
            test2.InsertAfter(new Run(new CommentReference() { Id = reply.CurrentCommentID.ToString() }), cmtEnd);
        }
</code></pre>

<p>I can see that the comment is put into the document using the debugger in VS, but it is not being displayed when I open the document. </p>

<p>After the save command is executed the comment is added to the document, but it doesn't display.</p>

<p>The overall goal here is to insert the comment after a specific comment in the list of comments that are contained in the document. Can someone help me find a solution to this?</p>