Free Support Forum - aspose.com

Style

Tommy,

Say I have an empty table defined like the following:






And I fill this table from DataTable - ImportDataTable call.

How do I set fonts per the whole table?

Do I need programmatically do it per cell?
Can I set default fonts per table from XML?

Thanks
Mark

basically if I have a table and want to assign my own fonts to be used for each row from what I understand i need to iterate through each text element and change it:



Table tableParticipantDetails = (Table)sectionParticipantHeader.Paragraphs[“PPTDetailsTbl”];
tableParticipantDetails.ImportDataTable(dtPptDetails,false,0,0);

foreach (Row r in tableParticipantDetails.Rows)
{
foreach (Cell c in r.Cells)
{
Paragraphs p = c.Paragraphs;
foreach(Text t in p)
{
t.TextInfo.FontName = “Arial Narrow”;
t.TextInfo.FontSize = 8;
}
}
}


pdf.save(…);




Looks very unefiicient, is there a way to change default fonts on a table level?






Thanks
Mark


Dear Mark,

Thanks for your consideration.

There is a Table.DefaultCellTextInfo property in API to set default text info in the table. But in XML it is not supported. I will add support for it in XML soon.

Dear Mark,

Thanks for your consideration.

Please download hot fix 1.6.4 here.