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

Free Support Forum - aspose.com

Highlight text for comment

when we add a comment, the comment does not highlight any text. It just appears at one point. just like the image below.comment_pointer.png (37.7 KB)
what I am looking is highlighting the word instead of pointer. Attaching the below image for reference.comment_highlight.png (69.0 KB)

Does Aspose has this feature.

@cacglo It looks like you are asking about commented rage. You can achieve this using CommentRangeStart and CommentRangeEnd nodes. Here a simple code that demonstrates how you can achieve this:

Document doc = new Document();

Comment newComment = new Comment(doc)
{
    Author = "Alexey Noskoc",
    Initial = "AN",
    DateTime = DateTime.Now
};

newComment.SetText("This is my cool comment.");

Paragraph para = doc.FirstSection.Body.FirstParagraph;
para.AppendChild(new Run(doc, "Text before commented text. "));
para.AppendChild(new CommentRangeStart(doc, newComment.Id));
para.AppendChild(new Run(doc, "Commented text. "));
para.AppendChild(new CommentRangeEnd(doc, newComment.Id));
para.AppendChild(newComment);
para.AppendChild(new Run(doc, "Text after commented text. "));

doc.Save(@"C:\Temp\out.docx");

out.docx (7.7 KB)