Cell Text with multiple Fonts

3 posts, 0 answers
  1. pierre-jean
    pierre-jean avatar
    113 posts
    Member since:
    Apr 2011

    Posted 04 Apr 2019 Link to this post

    Hello

    In a radGridView I have cells with multiline text (ex: LastName et FirstName separated by a carriage return) is it possible to set a different (smaller) font for the second line ? Or more generally speaking is it possible tu use formatting instructions in the text itself with tags or other instructions?

    Incidentally I would need this feature in textboxes as well.

    Thanks in advance

    PJ Pralong

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3758 posts

    Posted 08 Apr 2019 Link to this post

    Hello, Pierre-Jean,  

    In order to format the content in the grid cells in different fonts inside a single cell element, I can suggest you two approaches:

    The first one is to use the HTML-like text formatting functionality that RadGridView supports. Thus, you can handle the CellFormatting event and format the text according to your requirements. Ensure that the CellElement.DisableHTMLRendering property is set to false when you are going to use HTML-like text formatting. All supported HTML tags are listed in the following help article: https://docs.telerik.com/devtools/winforms/telerik-presentation-framework/html-like-text-formatting

    The second approach is to construct a custom cell element and insert a separate LightVisualElement for example for the content you want to have a specific font and formatting. A sample approach for constrcurting custom cells is demonstrated in the following help article: https://docs.telerik.com/devtools/winforms/controls/gridview/cells/creating-custom-cells

    Feel free to use this approach which suits your requirement best.

    As to the question about formatting the text inside a text-box in different fonts, I would recommend you to have a look at our RadRichTextEditor which is purposed to handle such scenarios. Additional information is available in the online documentation: https://docs.telerik.com/devtools/winforms/controls/richtexteditor/overview

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. pierre-jean
    pierre-jean avatar
    113 posts
    Member since:
    Apr 2011

    Posted 08 Apr 2019 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hello

    thanks a lot

    I had not realized it was possible to use HTML formatting. I think I'll go for this approach

    Regards

    Pierre-Jean

Back to Top