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

Free Support Forum - aspose.com

Table Width Issue when 1st row has ColumnsSpan


I am having an issue with the width of my table when I have a column span occurring in the 1st row. If the Column span is not in the 1st row then there is no issue.

Table has 4 columns, I am setting the width like so

loanDetailsTable.ColumnWidths = “15% 35% 15% 35%”;

//first row of table would be
Row tableRow = loanDetailsTable.Rows.Add();
tableRow.Cells.Add(“Credit Provider”, this.normalFontBold);
tableRow.Cells.Add((CommonItems.LenderOfRecord), this.normalFont);
tableRow.Cells[1].ColumnsSpan = 3;

//next table row
tableRow = loanDetailsTable.Rows.Add();
tableRow.Cells.Add(“Loan reference number”, this.normalFontBold);
tableRow.Cells.Add("", this.normalFont);
tableRow.Cells.Add(“Fund/Sector”, this.normalFontBold);
tableRow.Cells.Add(CommonItems.SectorCode, this.normalFont);

This second row and any subsequent row I add is not the same width (100%) as the 1st table row added above.

If I add 4 complete cells to the 1st row, and then add the column span row second there is no issues. The issue is only occurring when the 1 row added to the table has a cell with column span

I am using aspose.pdf

Any ideas?

Hi Andrew,

Thanks for your inquiry. I have tested the scenario with Aspose.Pdf for .NET 9.7.0 using new DOM approach for creating table and unable to replicate the issue. Please download and try latest version of Aspose.Pdf for .NET, it will resolve the issue.

Document doc = new

Page page = doc.Pages.Add();

Aspose.Pdf.Table loanDetailsTable = new Aspose.Pdf.Table();


loanDetailsTable.ColumnWidths = "15% 35% 15% 35%";

// Set the table border color as LightGray

loanDetailsTable.Border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, .5f, Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightGray));

// set the border for table cells

loanDetailsTable.DefaultCellBorder = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, .5f, Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightGray));

//first row of table would be

Aspose.Pdf.Row tableRow = loanDetailsTable.Rows.Add();

tableRow.Cells.Add("Credit Provider");


tableRow.Cells[1].ColSpan = 3;

//next table row

tableRow = loanDetailsTable.Rows.Add();

tableRow.Cells.Add("Loan reference number");





Please feel free to contact us for any further assistance.

Best Regards,