Remove current line

2 posts, 0 answers
  1. Ing. Jesus Manuel
    Ing. Jesus Manuel avatar
    16 posts
    Member since:
    Apr 2013

    Posted 10 Feb Link to this post

    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.
  2. Hristo
    Admin
    Hristo avatar
    1016 posts

    Posted 13 Feb Link to this post

    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.
Back to Top