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

Cell Text with multiple Fonts

2 Answers 303 Views
GridView
This is a migrated thread and some comments may be shown as answers.
pierre-jean
Top achievements
Rank 1
Veteran
Iron
pierre-jean asked on 04 Apr 2019, 06:06 PM

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 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 08 Apr 2019, 11:23 AM
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.
0
pierre-jean
Top achievements
Rank 1
Veteran
Iron
answered on 08 Apr 2019, 11:41 AM

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

Tags
GridView
Asked by
pierre-jean
Top achievements
Rank 1
Veteran
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
pierre-jean
Top achievements
Rank 1
Veteran
Iron
Share this question
or