Changing whole document font/size

2 posts, 0 answers
  1. Michael
    Michael avatar
    9 posts
    Member since:
    Dec 2014

    Posted 12 Dec 2014 Link to this post

    I've got a RichTextEditor that I'm filling with the output from an HtmlFormatProvider.Import

    After I've imported, I'd like to change the font and font size for the entire document.  Is there a way to do this?
  2. Hristo Merdjanov
    Hristo Merdjanov avatar
    664 posts

    Posted 17 Dec 2014 Link to this post

    Hello Michael,

    Thank you for contacting Telerik Support.

    Please refer to this help topic where you can find information regarding the Selection of text in our RichTextEditor control. Below is a code snippet with a sample implementation of selecting the available text in a RadDocument element and applying FontFamily and FontSize settings:
    public Form1()
        //Load html document
        using (Stream stream = new MemoryStream(File.ReadAllBytes(@"..\..\..\sample.html")))
            HtmlFormatProvider provider = new HtmlFormatProvider();
            this.radRichTextEditor1.Document = provider.Import(stream);
        //Select the entire text
        DocumentPosition startPosition = this.radRichTextEditor1.Document.CaretPosition;
        DocumentPosition endPosition = new DocumentPosition(startPosition);
        //Change font family and size
        this.radRichTextEditor1.RichTextBoxElement.ChangeFontFamily(new Telerik.WinControls.RichTextEditor.UI.FontFamily("Verdana"));

    I would also suggest that you get acquainted with our demo application and RichTextEditor example. The source code of the project is usually located at: C:\Program Files (x86)\Telerik\UI for WinForms Q3 2014\Examples\RichTextEditor.

    I hope that this information is useful. Should you have further question do not hesitate to write back.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. DevCraft R3 2016 release webinar banner
Back to Top