Free Support Forum - aspose.com

Column width is not same for each row of a wide table in PDF with RepeatingColumn using Aspose.PDF for .NET

Hi,

I’ve noticed that column width are incorrectly displayed when we are using repeating Column and wide tables. This occurs with both the TableBroken.Vertical and TableBroken.VerticalInSamePage properties.

In the reproducer, “header 6” column width is changing for each row.

Here is the reproducer:

public static void RepeatingColumn()
    {
       // Create a new document
        Document doc = new Document();
        Page page = doc.Pages.Add();

        Table mytable = new Table();
        mytable.Broken = TableBroken.VerticalInSamePage ;
        page.Paragraphs.Add(mytable);
        mytable.RepeatingColumnsCount = 3;
        mytable.ColumnWidths = "75 150 75 75 75 300";
        page.Paragraphs.Add(mytable);

        // Add header Row
        Row row = mytable.Rows.Add();
        var cell = row.Cells.Add("header 1");
        cell.BackgroundColor = Color.AliceBlue;
        var cell1 = row.Cells.Add("header 2");
        cell1.BackgroundColor = Color.Beige;
        var cell2 = row.Cells.Add("header 3");
        cell2.BackgroundColor = Color.BlanchedAlmond;
        var cell3 = row.Cells.Add("header 4");
        cell3.BackgroundColor = Color.Blue;
        var cell4 = row.Cells.Add("header 5");
        cell4.BackgroundColor = Color.Violet;
        var cell5 = row.Cells.Add("header 6");
        cell5.BackgroundColor = Color.BlueViolet;
        
        for (int RowCounter = 0; RowCounter <= 5; RowCounter++)

        {
            // Create rows in the table and then cells in the rows 
            Aspose.Pdf.Row row1 = mytable.Rows.Add();
            var cel21 = row1.Cells.Add("Row " + RowCounter + ", "+ "col "+ " 1");
            cel21.BackgroundColor = Color.AliceBlue;
            var cell11 = row1.Cells.Add("Row " + RowCounter + ", " + "col " + " 2");
            cell11.BackgroundColor = Color.Beige;
            var cell12 = row1.Cells.Add("Row " + RowCounter + ", " + "col " + "  3");
            cell12.BackgroundColor = Color.BlanchedAlmond;
            var cell13 = row1.Cells.Add("Row " + RowCounter + ", " + "col " + " 4");
            cell13.BackgroundColor = Color.Blue;
            var cell14 = row1.Cells.Add("Row " + RowCounter + ", " + "col " + " 5");
            cell14.BackgroundColor = Color.Violet;
            var cell15 = row1.Cells.Add("Row " + RowCounter + ", " + "col " + " 6");
            cell15.BackgroundColor = Color.BlueViolet;
        }
        doc.Save("RepeatingColumn.pdf");
    }

ColumnWidthIssue.JPG (201.7 KB)

@dfactset

We were able to reproduce the issue in our environment while using Aspose.PDF for .NET 20.7 and logged it as PDFNET-48601 in our issue tracking system for investigation and resolution purposes. We will inform you as soon as we have some certain updates about its rectificaion. Please spare us some time.

We apologize for the inconvenience.