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

Free Support Forum - aspose.com

Table cell padding not working in aspose.words


I've been trying to apply table cell padding to word/pdf documents generated from aspose.words but have been unsuccessful. I've tried this bot as a style in the markup and also in the aspose.word engine but its not working.

Below are the two ways that i used in aspose word engine to make the cell padding in tables work. Need help.

Formatting each cell in every table<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Node currentNode = documentBuilder.CurrentParagraph;

while (currentNode != null)


currentNode = currentNode.NextSibling;

if (currentNode != null && currentNode.NodeType == NodeType.Table)


Aspose.Words.Tables.Table table = currentNode as Aspose.Words.Tables.Table;

if (table != null)


foreach (Aspose.Words.Tables.Row row in table.Rows)


foreach (Aspose.Words.Tables.Cell cell in row.Cells)


cell.CellFormat.LeftPadding = 10;

cell.CellFormat.RightPadding = 10;






Format cell style using DocumentBuilde

DocumentBuilder documentBuilder = new DocumentBuilder(doc);

documentBuilder.CellFormat.LeftPadding = 10;

documentBuilder.CellFormat.RightPadding = 10;

where doc is an Aspose.Words.Document instance.

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I cannot reproduce the problem on my side using the latest version of Aspose.Words (9.3.0). You can download this version from here:


I use the following code for testing:

Document doc = new Document("in.doc");

Node[] nodes = doc.GetChildNodes(NodeType.Table, true).ToArray();

// Loop through all tables/rows/cells.

foreach (Table table in nodes)


foreach (Row row in table.Rows)


foreach (Cell cell in row.Cells)


cell.CellFormat.LeftPadding = 20;

cell.CellFormat.RightPadding = 20;





The input and the output documents are attached.

Could you please attach your input and expected output documents here for testing?

Best regards,