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

Reduce the available fonts in the RadRichTextBoxRibbonUI

1 Answer 71 Views
RichTextEditor
This is a migrated thread and some comments may be shown as answers.
ANTONIO
Top achievements
Rank 1
ANTONIO asked on 08 Apr 2020, 12:47 PM

Hi,
I'm using RadRichTextBoxRibbonUI to handle a richtext box.

By default the control creates a drop down list with all the available fonts of the system. I would like to restrict my user and provide him/her with specific ones.

I wold like that the fonts are not show in the drop down and not load them in the document, for instance if the user paste some text with other font the editor will not recognize the font and paste it with one of the defaults.

How do I do that?

 

Thanks!

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 09 Apr 2020, 09:39 AM

Hi Antonio,

You can inherit the RichTextEditorRibbonBar which will give you access to the drop-down list. Then you can hide the undesired items: 

class CustomRichTextEditorRibbonBar : RichTextEditorRibbonBar
{
    public CustomRichTextEditorRibbonBar()
    {
        foreach (var item in dropDownListFont.FontListView.Items)
        {
            if (item.Value.ToString().StartsWith("Arial"))
            {
               item.Visible = false;
            }
        }
    }
}

I hope this helps. Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
RichTextEditor
Asked by
ANTONIO
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or