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

RadRichText Set selection Text

1 Answer 47 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Sam
Top achievements
Rank 1
Sam asked on 09 Sep 2015, 09:27 AM

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?

1 Answer, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 11 Sep 2015, 02:43 PM
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
Tags
RichTextBox
Asked by
Sam
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Share this question
or