Articles in this section
Category / Section

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

1 min read

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

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied