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.
Unfortunately, activation email could not send to your email. Please try again.

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

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

Article ID: Published Date: Last Revised Date: Platform: Control:
5914 12/30/2015 12/30/2015 Windows Forms Presentation
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.