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

Free Support Forum - aspose.com

Words (.NET) - Table - How to set zero padding for cell content?

Hello, we have a purchased license.

We want to set zero padding for cell content, for example, here is zero padding between cell border and text:
Zero padding expected result.docx (7.4 KB)

We use following code to achieve this (simplified for demonstration):

var table = asposeBuilder.StartTable();
table.BottomPadding = 0;
table.LeftPadding = 0;
table.RightPadding = 0;
table.TopPadding = 0;

for (int i = 0; i < 5; i++)
    for (int j = 0; j < 5; j++)
        var cell = asposeBuilder.InsertCell();

        cell.CellFormat.SetPaddings(0, 0, 0, 0);
        cell.CellFormat.Borders.DistanceFromText = 0;

        asposeBuilder.Write($"Cell {i} {j}");



But result is:
Zero padding actual result.docx (7.4 KB)


We have tested the scenario using the latest version of Aspose.Words for .NET 21.6 and have not found the shared issue. So, please use Aspose.Words for .NET 21.6. We have attached the output document and its screenshot with this post for your kind reference.
21.6.docx (7.4 KB)
output.png (42.3 KB)