Articles in this section

Is there a way to have text with different styles in the same table cell?

Is there a way to have text with different styles in the same table cell?

Yes, you can apply different styles to the text in the same table cell. This can be achieved by drawing the texts at the specified positions with different styles using Graphics.

Refer to the following code example to apply styles in a cell.

C#

// Add the row and value to the cell
for (int i = 0; i < 10; i++)
{
    PdfGridRow pdfGridRow = pdfGrid.Rows.Add();
    pdfGridRow.Cells[0].Value = "Syncfusion";
    pdfGridRow.Cells[1].Value = "Software";
} // Apply the font pdfGrid.Style.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 14, PdfFontStyle.Regular); // Draw the string in cell page.Graphics.DrawString("Software", new PdfStandardFont(PdfFontFamily.TimesRoman, 14F, PdfFontStyle.Bold), PdfBrushes.Black, new PointF(100, 0)); // Draw the Grid pdfGrid.Draw(page, new PointF(0,0));

Sample link:

https://www.syncfusion.com/downloads/support/directtrac/general/PdfGridSample-593662040.zip

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