Cell text overflow

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v11)  /  Cell text overflow

DynamicPDF CoreSuite for .NET (v11) Forum

 Jul 30 2021 12:21 AM
Hi Team,

I am generating PDF with table. I set my table height, but there is lot of data in one cell. I need cell should be split with data in second page once it reach to table max height. 
My page having footer in all the pages and cell data overlapping on footer.
This is dynamic data so it difficult to predict when it will be overflow or less.

Please let me know how we can achieve this.

Regards,
Chandan Singh
 Jul 30 2021 1:51 PM
Posted by a ceTe Software moderator
Hello Chandan,

Please try setting the Splittable  property of the Cell2 object to true and see it resolves the issue for you.

Here is a code sample:

            Document document = new Document();
            Table2 table = new Table2(0, 0, 200, 600);
            table.Columns.Add(100);
            table.Columns.Add(100);

            string dynamicText = @"This is to test :: ";
            for (int i = 0; i < 10; i++)
            {
                dynamicText += dynamicText;
            }
            Row2 row1 = table.Rows.Add(20);
            Cell2 cell1=row1.Cells.Add(dynamicText);
            cell1.Splittable = true;
            row1.Cells.Add("Item1");
           
            //Add other rows to table
            for (int i = 1; i <= 5; i++)
            {
                Row2 row = table.Rows.Add(20);
                row.Cells.Add("Row #" + i);
                row.Cells.Add("Item");
            }

            do
            {
                Page page = new Page(PageSize.Letter, PageOrientation.Portrait, 50);
                document.Pages.Add(page);
                page.Elements.Add(table);
                table = table.GetOverflowRows();
            } while (table != null);

            // Save the PDF
            string pdfFilePath = @"C:\Temp\MyDocument.pdf";
            document.Draw(pdfFilePath);
          
Thanks,
ceTe Software Support Team

All times are US Eastern Standard time. The time now is 1:13 AM.