Hi Team,
I want to change the RadRichTextBox content(remove some invalid characters) in LostFocus event. Initially, i have loaded the RadRichTextBox with some header and footer content. Then, i am entering some data(Paste data also) and tabout. While losing the focus, need to remove some invalid character and save in the same document. I have tried like below.
Telerik.Windows.Documents.FormatProviders.Txt.TxtFormatProvider provider = new Telerik.Windows.Documents.FormatProviders.Txt.TxtFormatProvider();
string output = provider.Export(richtextbox.Document); // getting textbox's text
string text = output;
foreach (char letter in text)
{
if (//Condition)
{
// here remove some invalid characters based on some condition.
output = output.Remove(index, 1);
}
}
RadDocument document = new RadDocument();
document = provider.Import(output);
radRichTextBox.Document = document; // update the document .. It is an error
object Docx = docprovider.Export(document); // DocxFormatProvider
After removing the some content, document's header and footer also removed. Can you please suggest how to edit the content of RadRichTextBox ?