Free Support Forum - aspose.com

How to make a row bold?

Hi,

Can you please show me how to make a row in a pdf table BOLD?

I tried using the following, but it does not work:

tab1.ImportDataTable(dtData, false,2, 0);

Row RowSum = tab1.Rows.Add();

RowSum.DefaultCellTextInfo.IsTrueTypeFontBold = true;

Hi,

Thank you for considering Aspose.

DefaultCellTextinfo property of Row and table is not working properly, I have logged this issue in our defect database as issue # PDFNET-4066. We will investigate this issue. For a workaround, please use the following code to loop through each cell to set it's Font property to Bold. Here is the code chunk:

foreach (Aspose.Pdf.Row row in table.Rows)

{

foreach (Aspose.Pdf.Cell cell in row.Cells)

{

foreach (Text text in cell.Paragraphs)

{

Aspose.Pdf.TextInfo txtInfo = new Aspose.Pdf.TextInfo();

txtInfo.FontSize = 14;

txtInfo.FontName = "Arial";

txtInfo.IsTrueTypeFontBold = true;

txtInfo.IsTrueTypeFontItalic = true;

foreach (Segment seg in text.Segments)

{

seg.TextInfo = txtInfo;

}

}

}

}

If you need more help, please do let us know.

Thanks.

How to make the same text bold if I do not use “Arial”? I want to keep the default font style so that the rest of my PDF’s font style is consistant throughout. Once I removed the line “txtInfo.font = Arial”, the bolded effect dispears. Please help.

Hi,

Please use txtInfo.FontName = table.DefaultTextInfo.FontName.

Thanks.

Hi,

I tried this code.

Once I changed to use font name "DefaultCellTextInfo.Fontname", the boldedness dispeared.

Hi,

Can you please share your full code and the Pdf output so that we could exactly determine the cause of this problem.

Thanks.

Hi,

The new hot fix Aspose.Pdf 3.6.2.0 has been published and the fix of PDFNET-4066 is included. Please download it follow this link: http://www.aspose.com/Community/Files/
Thanks.

Best regards.