Change font from code

2 posts, 0 answers
  1. Gokhan
    Gokhan avatar
    2 posts
    Member since:
    Nov 2013

    Posted 21 Dec 2014 Link to this post

    I can not change fonts of some parts of the documents.
    editor.InsertLine(" message")
    Some pars of lines tahoma some parts of lines are Times New Roman

    Thanks..
  2. Deyan
    Admin
    Deyan avatar
    136 posts

    Posted 24 Dec 2014 Link to this post

    Hello Gokhan,

    Thank you for contacting us.

    You can change the font family of some particular parts of text by using RadFlowDocumentEditor's CharacterFormatting property. The following code snippet shows how to insert two paragraphs with text - the first one is with font family "Jokerman" and the second one is with font family "Times New Roman":
    editor.CharacterFormatting.FontFamily.LocalValue = new ThemableFontFamily("Jokerman");
    editor.InsertText("First paragraph is Jokerman.");
    editor.InsertParagraph();
    editor.CharacterFormatting.FontFamily.LocalValue = new ThemableFontFamily("Times New Roman");
    editor.InsertText("Second paragraph is Times New Roman.");

    You can find more information about styling the content by following this link to Chaging Current Styles documentation section.

    I hope this is helpful. If you have any other questions or concerns do not hesitate to contact us again.

    Regards,
    Deyan
    the Telerik team
     

    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.

     
Back to Top