Approved
Last Updated: 30 Mar 2016 11:10 by ADMIN
ADMIN
George
Created on: 24 Sep 2014 12:38
Category: RichTextEditor
Type: Bug Report
0
FIX. RadRichTextEditor - empty characters at the end of a sentence are being underlined
To reproduce:

Open TelerikEditor and underline the whole text. Go to the end of a line and hold space. You will notice that the empty spaces are being underlined. The behavior is not the same as in Word.

Workaround:

Remove the underlining of the empty spaces at the end of the lines:

void Button_Click(object sender, EventArgs e)
{
    var caret = this.richTextBox.Document.CaretPosition;
    var originalPosition = new DocumentPosition(caret);
    caret.MoveToFirstPositionInDocument();
    do
    {
        caret.MoveToCurrentLineEnd();
        var endPos = new DocumentPosition(caret);

        caret.MoveToCurrentWordStart();
        caret.MoveToCurrentWordEnd();

        var startPos = new DocumentPosition(caret);

        this.richTextBox.Document.Selection.AddSelectionStart(startPos);
        this.richTextBox.Document.Selection.AddSelectionEnd(endPos);
        this.richTextBox.ChangeUnderlineDecoration(UnderlineType.None);
        this.richTextBox.Document.Selection.Clear();

        caret.MoveToCurrentLineEnd();

    }
    while (caret.MoveToNext());

    caret.MoveToPosition(originalPosition);
}

Beware that this workaround will not work in all cases. It should be used only prior to exporting or similar cases
0 comments