Free Support Forum - aspose.com

How can i make part of a text cell bold

I have the following code to populate a powerpoint table cell using aspose.net slides. I am trying to get part of a cell bold (but keep the rest of it as regular text. Is this possible.

I want to make the car.Name in bold in this line of code below.

tbl[0, row].TextFrame.Text = "[" + car.Name+ "] " + car.Description

here is the full code for reference

TableEx tbl = null;
foreach (ShapeEx shp in sld.Shapes)
{
if (shp is TableEx)
{
tbl = (TableEx)shp;
if (tbl.AlternativeText == altText)
{
int row = 0;
foreach (var car in cars)
{
if (row > 0)
{
tbl.Rows.AddClone(tbl.Rows[0], true);
}
tbl[0, row].TextFrame.Text = "[" + car.Name+ "] " + car.Description;
tbl[1, row].TextFrame.Text = car.Year;
row++;
}
}
}
}

Hi Adam,


I have observed the requirements shared by you and like to share that fonts related properties are set on portion level. Every text frame has collection of paragraphs inside it. The paragraphs are formed based on line feed or carriage return inside text. Inside every paragraph there is collection of portions. The text formatting and font related properties portions are set on portion level. If we have a following line in text inside text frame:

Welcome to Aspose.Slides
Hello World

There are two paragraphs inside the text frame based on line feeds. The text inside text frame has following paragraph and portion indices.

Pargraph 1, Portion 1: Welcome
Pargraph 1, Portion 2: to
Pargraph 1, Portion 3: Aspose.Slides

Pargraph 2, Portion 1: Hello
Pargraph 2, Portion 2: World

So, in order to set the font boldness of individual text color, you need to set that on portion level. Please visit this documentation link for your kind reference.

Many Thanks,