RadRichText Set selection Text

2 posts, 0 answers
  1. Sam
    Sam avatar
    5 posts
    Member since:
    Oct 2014

    Posted 09 Sep 2015 Link to this post

    Hello

    I want to modify the selected text in code.

    Something like below:

     this.RTFEditor.Editor.Document.Selection.Text="MyNewText";

     

    Would you please have a look?

  2. Tanya
    Admin
    Tanya avatar
    405 posts

    Posted 11 Sep 2015 Link to this post

    Hi,

    I am pasting the answer here to make it available for our community in case someone else encounters this question:

    The behavior is the same as in the UI. When you select text and you start typing the old text is removed and new text is inserted.

    Having this in mind the available approaches to achieve your scenario are two:
     1. Delete the text using the RadRichTextBox.Delete method and insert the new text.
     2. Or just simply insert the new text using RadRichTextBox.Insert method.


    Regards,
    Tanya
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
Back to Top