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

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.

@Adnan.Ahmad,
I have created two pdf (ExpectedPdfCreatedUsingAsposeExcel.pdf using Aspose.Excel and UnExpectedPdfCreatedUsingAsposeExcel.pdf using Aspose.Pdf).
I can see the difference for cell border in both pdf. Please have a look at attached PDF.

UnexpectedPdfCreatedUsingAsposePdf.pdf (47.4 KB)
ExpectedPdfCreatedUsingAsposeExcel.pdf (53.1 KB)

@dfactset,

Thanks for sharing files with us.

Hi @Adnan.Ahmad,

Any update on the above mentioned issue?

@dfactset,

We are looking into this issue again. I request for your patience.

Hi @adnanahmed

Any update on this issue?

@dfactset

We have again tested the scenario in our environment using Aspose.PDF for .NET 20.6 and obtained attached PDF document. Would you please check it and highlight the issues you see in it. Also, we have attached a screenshot in which we pointed towards the issues which we noticed as per our understandings. Please share your feedback with us so that we can further proceed to address all issues.

IncorrectColspanBorders.pdf (3.5 KB)
borderissues.png (69.4 KB)

@asad.ali

Thank you for looking into this issue. I verified the issue with the same reproducer mentioned above with Aspose.PDF for .NET 20.6 and 20.7 and it seems that the cell border is still incorrect.

@dfactset

We have logged another ticket as PDFNET-48525 in our issue tracking system to re-investigate the scenario. We will keep you informed about the progress towards resolution of this ticket. Please be patient and spare us some time.

We are sorry for the inconvenience.

@dfactset

We have initially investigated the ticket and found that we already had removed the borders when issue was logged under previously-logged ticket i.e. PDFNET-41625.

Please check the above screenshot which we had shared with you in order to verify the issues. We request you to please share a screenshot showing the difference between expected and generated results. It would really help us understand the issue and resolve it accordingly. We greatly appreciate your cooperation in this regard.

We are sorry for the trouble faced.

Hi @asad.ali

I am pointing out the issue in attached image.

borderissues_Return.png (70.4 KB)

I have already posted the expected and unexpected result in comment above. Please have a look on this and let me know if you have any concern.

@dfactset

Thanks for your response.

We did check the files which you had shared earlier. However, the content and table size is smaller in the file than in the image which is causing confusion in noticing the issue. We could only notice that the border width (between two rows) was thicker in the PDF generated by Aspose.PDF. Is it the issue that you are referring to?

Furthermore, in your shared image, we have noticed following:

  • in first row, only right border is missing
  • in 4th row, both right and left borders are missing
  • in 10th row, the border width is not correct

Please confirm if our understandings are correct about the actual issue that you are facing so that we can further proceed accordingly. We apologize for the confusion.

@asad.ali

As per my understanding 1st Row and 4th row are as expected.
Issue is in 10th row which are as follows -:

  1. left border should be missing like left border of 4th row.
  2. right border (of red color) width is not correct.

I am attaching an image where I have pointed out the issue with red circle.

borderissues.png (67.9 KB)

Please let me know if you have any concern.

@dfactset

Thanks for your cooperation.

We have noted the provided information and now will investigate to resolve the pointed issues. We will let you know in case we require more information from your side.

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

Thank you @asad.ali for looking into issue. I verified the issue with the reproducer mentioned at down with Aspose.PDF for .NET 20.8 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 wideTable()
        {
            Document 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, 27, 27, 27);

            //Instantiate a table object that will be nested inside outerTable that will break
            //inside the same page
            var mytable = new Aspose.Pdf.Table();
            mytable.Broken = TableBroken.VerticalInSamePage;
            mytable.DefaultCellBorder = new BorderInfo(BorderSide.All);
            mytable.ColumnWidths = "160 160 160 160 160 160";
            page.Paragraphs.Add(mytable);

            //Add header Row
            var row = mytable.Rows.Add();
            row.Cells.Add("TextHeader Row 1 Column 1");
            row.Cells.Add("TextHeader Row 1 Column 2");
            row.Cells.Add("TextHeader Row 1 Column 3");
            row.Cells.Add("TextHeader Row 1 Column 4");
            row.Cells.Add("TextHeader Row 1 Column 5");
            row.Cells.Add("TextHeader Row 1 Column 6");


            //Create rows in the table and then cells in the rows 
            var row1 = mytable.Rows.Add();
            var cell = row1.Cells.Add("Row 2 Col 1");
            cell.ColSpan = 4;
            cell.BackgroundColor = Color.Red;
            row1.Cells.Add("Row 2 Col 5");
            row1.Cells.Add("Row 2 Col 6");

            var row2 = mytable.Rows.Add();
            cell = row2.Cells.Add("Row 3 Col 1");
            cell.ColSpan = 3;
            cell.BackgroundColor = Color.Green;
            row2.Cells.Add("Row 3 Col 4");
            row2.Cells.Add("Row 3 Col 5");
            row2.Cells.Add("Row 3 Col 6");

            var row3 = mytable.Rows.Add();
            row3.Cells.Add("Row 4 Col 1");
            row3.Cells.Add("Row 4 Col 2");
            row3.Cells.Add("Row 4 Col 3");
            row3.Cells.Add("Row 4 Col 4");
            row3.Cells.Add("Row 4 Col 5");
            row3.Cells.Add("Row 4 Col 6");

            doc.Save("wideTable.pdf");
        }

I am attaching an image also where I have pointed out the issue with red circle.

wideTable.pdf (35.7 KB)
wideTable.JPG (114.4 KB)