Create wide table in PDF with Colspan using Aspose.PDF for .NET - Incorrect Cell borders

Hi,

I’ve noticed that cell borders are being incorrectly displayed with some breaks and whitespaces when we are using colspans and wide tables. This occurs with both the TableBroken.Vertical and TableBroken.VerticalInSamePage properties.
In the reproducer, the first row has 2 cells that span 20 cells each. I made the cell backgrounds a different color so that they are more distinct. As you can see, the table is incorrectly rendering some white cell borders in the sections that do not contain the cell text. Also, I would expect the the left cell border of “Header cell 1” to be at the beginning of the first cell of the red background and the right cell border to be at the end of the last cell with the red background. Otherwise, you wouldn’t be able to tell that it is a continuous cell. If it wasn’t for the different background colors, you cannot tell that the colspan represents a single cell.
Here is the reproducer:

var doc = new Document();
            var page = doc.Pages.Add();
            page.PageInfo.Width = PageSize.PageLetter.Width;
            page.PageInfo.Height = PageSize.PageLetter.Height;
            page.PageInfo.Margin = new MarginInfo(27, 47, 27, 27);
            //Instantiate a table object
            var mytable = new Aspose.Pdf.Table();
            //mytable.Broken = TableBroken.Vertical;
            mytable.Broken = TableBroken.VerticalInSamePage;
            mytable.DefaultCellBorder = new BorderInfo(BorderSide.All, Color.Black);
            mytable.DefaultCellPadding = new MarginInfo(5, 1, 5, 1);
            page.Paragraphs.Add(mytable);
            var headerRow = mytable.Rows.Add();
            var firstspan = headerRow.Cells.Add(“Header cell 1”);
            firstspan.BackgroundColor =  Color.Red;
            firstspan.ColSpan = 20;
            var secondspan = headerRow.Cells.Add(“Header cell 2”);
            secondspan.ColSpan = 20;
            secondspan.BackgroundColor = Color.LightBlue;
            var dataRow = mytable.Rows.Add();
            for (var i = 1; i <= 40; ++i)
            {
                var cell = dataRow.Cells.Add($“Testing text {i}”);
                cell.BackgroundColor = Color.FromRgb(ColorTranslator.FromHtml(@"#F0F0F0"));
            }
            var dataRow2 = mytable.Rows.Add();
            for (var i = 1; i <= 40; ++i)
            {
                var cell = dataRow2.Cells.Add($“Testing text {i}”);
                cell.BackgroundColor = Color.White;
            }
            doc.Save(“IncorrectColspanBorders.pdf”);

Hi Daniel,


Thanks for using our API’s.

I have tested the scenario and have managed to reproduce same problem. For the sake of correction, I have logged it as PDFNET-41625 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

What is the status of this bug fix?

When can we expect this to be released?

Hi Daniel,


Thank you for the inquiry. The linked ticket ID PDFNET-41625 is pending for the analysis and not resolved yet. We have asked our product team to take a look at your issue shortly. We shall let you know once an update is available from them.

Is there any update on this?

When can we expect this to be released?

@dfactset,

I regret to inform that issue is still unresolved and we have increased issue priority. We will share good news with you soon.

Hi @Adnan.Ahmad,

I see the status of the ticket PDFNET-41625 as closed.
Is it possible to get the updated version of Aspose.PDF to test this at our end?

Thanks.

@dfactset,

I have verified the issues status from our issue tracking system and like to share that the concerned issue have been marked as resolved in upcoming Aspose.PDF for .NET 20.2. We will share the good news with you as soon as the product will be rolled online.

The issues you have found earlier (filed as PDFNET-41625) have been fixed in Aspose.PDF for .NET 20.2.

Hi @Adnan.Ahmad ,

I verified the reproducer mentioned above with Aspose.PDF for .NET 20.2 and it seems to be working fine. But, there are certain scenario where the cell border is still incorrect.

I am attaching the reproducer below along with the output pdf. Please have a look at this issue.

Here is the reproducer:

void wide_table_Column()
{
var doc = new Document();
var page = doc.Pages.Add();
page.PageInfo.Width = PageSize.PageLetter.Width;
page.PageInfo.Height = PageSize.PageLetter.Height;
page.PageInfo.Margin = new MarginInfo(27, 47, 27, 27);
//Instantiate a table object
var mytable = new Aspose.Pdf.Table();
//mytable.Broken = TableBroken.Vertical;
mytable.Broken = TableBroken.VerticalInSamePage;
mytable.DefaultCellBorder = new BorderInfo(BorderSide.All, Color.Black);
mytable.DefaultCellPadding = new MarginInfo(5, 1, 5, 1);
page.Paragraphs.Add(mytable);
var headerRow = mytable.Rows.Add();
var firstspan = headerRow.Cells.Add(“Header cell 1”);
firstspan.BackgroundColor = Color.Red;
firstspan.ColSpan = 19;
var secondspan = headerRow.Cells.Add(“Header cell 2”);
secondspan.ColSpan = 20;
headerRow.Cells.Add(“Header cell 3”);
secondspan.BackgroundColor = Color.LightBlue;
var dataRow = mytable.Rows.Add();
for (var i = 1; i <= 40; ++i)
{
var cell = dataRow.Cells.Add($“Testing text { i}”);
cell.BackgroundColor = Color.FromRgb(ColorTranslator.FromHtml(@"#F0F0F0"));
}
var dataRow2 = mytable.Rows.Add();
for (var i = 1; i <= 40; ++i)
{
var cell = dataRow2.Cells.Add($“Testing text {i}”);
cell.BackgroundColor = Color.White;
}
doc.Save(“IncorrectColspanBorders.pdf”);
}

IncorrectColspanBorders.pdf (42.2 KB)

Thanks.

@dfactset,

I have worked with sample code shared by you and have been able to observe the issue. I request for your patience and we are looking into this in more details.

Is there any update on this?

@dfactset,

This issue has been resolved. Can you please check on your end and share feedback with us.

Hi @Adnan.Ahmad,

I have verified the issue with Aspose.PDF 20.3 which is mention here. I am still able to observe the issue in Aspose.PDF 20.3

@dfactset,

We are investigating this again and will reopen this issue after initial investigation.

Hi @Adnan.Ahmad,

Any update on the above mentioned issue?

@dfactset,

We are working on this and will share good news with you soon.

@dfactset,

I like to inform that we have worked and unable to observe the issue. Can you please share screenshot pointing towards the issue to further investigate this.

Hi @Adnan.Ahmad

Thank you for looking into this issue. I verified the issue with the reproducer mentioned down with Aspose.PDF for .NET 20.4 and it seems that the cell border is still incorrect.
I am attaching the reproducer below along with the output pdf. Please have a look at this issue.

Here is the reproducer:

 static void wide_table_Column()
    {
        var doc = new Document();
        var page = doc.Pages.Add();
        page.PageInfo.Width = PageSize.PageLetter.Width;
        page.PageInfo.Height = PageSize.PageLetter.Height;
        page.PageInfo.Margin = new MarginInfo(27, 47, 27, 27);

        //Instantiate a table object
        var mytable = new Aspose.Pdf.Table();
        //mytable.Broken = TableBroken.Vertical;
        mytable.Broken = TableBroken.VerticalInSamePage;
        mytable.DefaultCellBorder = new BorderInfo(BorderSide.All, Color.Black);
        mytable.DefaultCellPadding = new MarginInfo(5, 1, 5, 1);
        page.Paragraphs.Add(mytable);

        var headerRow = mytable.Rows.Add();
        var firstspan = headerRow.Cells.Add("Header cell 1");
        firstspan.BackgroundColor = Color.Red;
        firstspan.ColSpan = 19;
        var secondspan = headerRow.Cells.Add("Header cell 2");
        secondspan.ColSpan = 20;
        headerRow.Cells.Add("Header cell 3");
        secondspan.BackgroundColor = Color.LightBlue;

        var dataRow = mytable.Rows.Add();
        for (var i = 1; i <= 40; ++i)
        {
            var cell = dataRow.Cells.Add($"Testing text { i}");
            cell.BackgroundColor = Color.FromRgb(ColorTranslator.FromHtml(@"#F0F0F0"));
        }

        var dataRow2 = mytable.Rows.Add();
        for (var i = 1; i <= 40; ++i)
        {
            var cell = dataRow2.Cells.Add($"Testing text {i}");
            cell.BackgroundColor = Color.White;
        }

        doc.Save("IncorrectColspanBorders.pdf");

    }

IncorrectColspanBorders.pdf (42.2 KB)

@dfactset,

Can you please share comparison screenshot pointing towards the issue. As we requested earlier we are working on this and from our end output is fine. So please if you can point out to direction so that we may help you out.