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

Free Support Forum - aspose.com

Incorrect table padding

Hi,

Aspose Words returns incorrect values for the paddings of tables and cells.

In the attached document, the left and right paddings should be 5.4pt but Aspose Words returns 0.

Here is the code to reproduce with the attached document:

Document doc = new Document(@"D:\Tests\TEST_AFI#1-TEMPLATE_1.DOC");

NodeCollection tables = doc.GetChildNodes(NodeType.Table, true);

foreach (Table table in tables)

{

Console.WriteLine("table.LeftPadding:" + table.LeftPadding + " table.RightPadding:" + table.RightPadding

+ " table.TopPadding:" + table.TopPadding + " table.BottomPadding:" + table.BottomPadding);

foreach (Cell cell in table.GetChildNodes(NodeType.Cell, true))

{

Console.WriteLine("cell.CellFormat.LeftPadding:" + cell.CellFormat.LeftPadding + " cell.CellFormat.RightPadding:" + cell.CellFormat.RightPadding

+ " cell.CellFormat.TopPadding:" + cell.CellFormat.TopPadding + " cell.CellFormat.BottomPadding:" + cell.CellFormat.BottomPadding);

}

}


Do you have a workaround for this?

Thank you very much.

Best regards,

Hi Calvo,


Thanks for your inquiry. The style “Tableau Normal” is applied to this table. As a workaround you can convert formatting specified in table styles into direct formatting on tables in the document. After calling the following method, you can access the padding information using normal API:

Document.ExpandTableStylesToDirectFormatting Method

I hope, this helps.

Best regards,

Hello,

It helped. :slight_smile:

Thank you very much.

Best regards,