I am creating a simple Text Tagging Application using the Comments feature of RichTextEditor.
The functionality is very simple, User loads Text File in a RichTextEditor and Adds a Bunch of comments. There is nothing else the user can do. There is no formatting or images.
Once the user has done commenting, he can press a button to say "Complete". Now I want to know Each comment, the Text the user selected for commenting from the Original document, and the Ordinal position of the original selection in the document.
I was able to get all Comment objects, All CommentRangeStart and CommentRangeEnd objects along with the Span object which has the Text.
I am able to get what the user commented on what text. However I am not able to find the Position of the text in the original document. Please help.
Reference:
1.
foreach
(var start
in
rtf.Document.GetAnnotationMarkersOfType<CommentRangeStart>())
2.
{
3.
CommentRangeEnd end = (CommentRangeEnd)start.End;
4.
Comment comment = end.Comment;
5.
Span textSpan = (Span)start.NextSibling;
6.
int
positionOfText = ??
7.
msgBoxString += comment.Author +
": "
+ textSpan.Text +
"\r\n"
;
8.
}