We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to add text with different styles in the same table cell?

Platform: WPF |
Control: Presentation |
Published Date: December 30, 2015 |
Last Revised Date: December 30, 2015
Tags:

Essential Presentation library provides support for adding customized text content to a table cell.

The below code example demonstrates accessing the first cell in the first row and adding a paragraph to it.

//Get cell instance from the table.

ICell cell1 = table.Rows[0].Cells[0];

//Add paragraph to add text content.

IParagraph paragraph1 = cell1.TextBody.AddParagraph();

 

You can add a customized text to a paragraph by adding an ITextPart instance. The below code example demonstrates this. You can and one or more customized ITextPart instances to a same paragraph.

//Add text part to the paragraph

ITextPart textPart1 = paragraph1.TextParts.Add();

//set value for the text content.

textPart1.Text = "Style1";

//Enable bold option.

textPart1.Font.Bold = true;

//Choose caps type of the text.

textPart1.Font.CapsType = TextCapsType.Small;

//set color to the text.

textPart1.Font.Color = ColorObject.CadetBlue;

//Set font style using font name.

textPart1.Font.FontName = "Times New Roman";

 

You can find the complete sample here

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon