Clear formatting

2 posts, 0 answers
  1. Dominik
    Dominik avatar
    59 posts
    Member since:
    Dec 2012

    Posted 26 Nov 2015 Link to this post

    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);
    }

      

     

  2. Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 27 Nov 2015 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top