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

Remove current line

1 Answer 102 Views
RichTextEditor
This is a migrated thread and some comments may be shown as answers.
Ing. Jesus Manuel
Top achievements
Rank 1
Ing. Jesus Manuel asked on 11 Feb 2017, 05:09 AM
Hello, I have the caretposition in a blank line, it just have the Enter symbol, I want to remove this line, I can't find a method to do this, you think you cal help me? Please.

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 13 Feb 2017, 05:25 PM
Hello Jesus, 

Thank you for writing.

You can utilize the document position API and then execute the Delete command. Please check my code snippet below: 
private void button1_Click(object sender, EventArgs e)
{
    DocumentPosition startPosition = new DocumentPosition(this.radRichTextEditor1.Document.CaretPosition);
    DocumentPosition endPosition = new DocumentPosition(startPosition);
    startPosition.MoveToPreviousInline();
    endPosition.MoveToCurrentWordEnd();
    this.radRichTextEditor1.Document.Selection.SetSelectionStart(startPosition);
    this.radRichTextEditor1.Document.Selection.AddSelectionEnd(endPosition);
 
    this.radRichTextEditor1.Commands.DeleteCommand.Execute();
}

I am also sending you a short video showing the result on my end.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
RichTextEditor
Asked by
Ing. Jesus Manuel
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or