We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Bold text of specific cell

How can I set the text of a particular call bold?

Row newRow = rowTemplate.Clone(true) as Row;
int currentCell = 0;
if (newRow != null)
{
newRow.Cells[currentCell++].FirstParagraph.Runs[0].Text = firstProductViewModel.Address;
//set this cell to bold

}

Hi Ruchi,


Thanks for your inquiry. Please use Run.Font.Bold property to set the text formatting as bold. You need to iterate through all Run nodes of table’s cell and use this property. Please check the following code example. Hope this helps you.

Document doc = new Document(MyDir + “in.docx”);<o:p></o:p>

Table table = (Table)doc.GetChild(NodeType.Table, 0, true);

//Bold the text of first cell in first row of table.

Cell cell = table.Rows[0].Cells[0];

foreach (Run run in cell.GetChildNodes(NodeType.Run, true))

{

run.Font.Bold = true;

}

doc.Save(MyDir + "17.2.0.docx");