This is a migrated thread and some comments may be shown as answers.

Trailing blanks in hyperlinks

1 Answer 51 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Michael Shaich
Top achievements
Rank 1
Michael Shaich asked on 20 Dec 2012, 01:02 AM
Hi:

I'm having issues when users create hyperlinks with trailing blanks.  I can avoid this in some cases where the blanks are at the end of the line.  I programatically remove the trailing blanks from the selected text parameter in the InsertHyperlink call.  That works great.  However, when the selected text is not at the end of the line, the characters of the link run together with the next word.  So how can I determine if a trailing blank is at the end of a line?

Example
Text line = "Now is the time "
If the user selects "time " and inserts a link there, the trailing blank is not included in the link.  That is good.
However, if the user double-clicks "the", "the " is highlighted automatically.  When a link is inserted, the resulting line looks like this:
"Now is thetime".  So in this case, I don't want to trim the text I specify when I insert the link.  How do I tell?  The documentmodel is pretty complex.

Thanks!

1 Answer, 1 is accepted

Sort by
0
Boby
Telerik team
answered on 26 Dec 2012, 09:40 AM
Hello Michael,
You can check if a DocumentPosition is at the end of the line by creating temporary copy and move it to the end of the line:
DocumentPosition selectionEnd = this.radRichTextBox.Document.Selection.Ranges.First.EndPosition;
DocumentPosition position = new DocumentPosition(selectionEnd);
position.MoveToCurrentLineEnd();
 
if (position == selectionEnd)
{
     
}

We will log your your problem as feature request and will try to implement it in some of the future releases. We have added points to your account for the suggestions. Don't hesitate to contact us if you have other questions.


Kind regards,
Boby
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
RichTextBox
Asked by
Michael Shaich
Top achievements
Rank 1
Answers by
Boby
Telerik team
Share this question
or