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

Clear formatting

1 Answer 126 Views
RichTextEditor
This is a migrated thread and some comments may be shown as answers.
konrad
Top achievements
Rank 1
konrad asked on 26 Nov 2015, 10:26 AM

Hi,

I am trying to clear formatting by using below command:

ClearFormattingCommand command = new ClearFormattingCommand(cEditor.RichTextBoxElement.ActiveEditor);
command.Execute();

However, font and size (bigger) different that set by:

private void SetDef(RadDocumentEditor editor)
{
    editor.ChangeFontFamily(new Telerik.WinControls.RichTextEditor.UI.FontFamily("Tahoma"));
    editor.ChangeFontSize(Unit.PointToDip(10));
    editor.ChangeFontStyle(Telerik.WinControls.RichTextEditor.UI.FontStyles.Normal);
    editor.ChangeFontWeight(Telerik.WinControls.RichTextEditor.UI.FontWeights.Normal);
    editor.ChangeParagraphSpacingAfter(0);
}

  

 

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 27 Nov 2015, 10:42 AM
Hi Dominik,

Thank you for writing.

You should select the content first:
void button_Click(object sender, EventArgs e)
{
    radRichTextEditor1.Document.Selection.SelectAll();
    ClearFormattingCommand command = new ClearFormattingCommand(radRichTextEditor1.RichTextBoxElement.ActiveEditor);
    command.Execute();
    radRichTextEditor1.Document.Selection.Clear();
}

Please let me know if there is something else I can help you with. 
 
Regards,
Dimitar
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
RichTextEditor
Asked by
konrad
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or