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
Cell text overflow
Re: Cell text overflow
Support · Jul 30, 2021Hello 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