Hi Team,
I am trying to add table that having more than 10000 rows. Before starting a table there is two TextArea on the page that took around 20 percent area of page from top. After that I need to start my table. So in this case on first page its showing two TextArea and table with 10 rows. Once system is checked where we have overflow table its start splitting the table. In next page I am not going to add any TextArea on top. Here table is starting from top of the page (as expected).
But problem is that its again showing only 10 Rows in this page and leaving good amount of blank area where it can fit 5 or 7 more rows in the same page.
So due to this issue my table data going more than 400 pages, and showing blank area end of each table on each page.
How to fix this issue? So the system should show 10 rows in first page and after overflow, from next page onward it should show 15 or 20 rows without extra blank spaces.
Please let me know for other clarification.
Thanks & Regards,
Chandan Singh
Blank area shows on page after applying Table overflow
Re: Blank area shows on page after applying Table overflow
Support · Sep 8, 2021Hi Chandan,
You will need to change the height and positions for the overflow table and add contents to the new page.
Here is a code sample:
Document document = new Document();
Page firstpage = new Page();
document.Pages.Add(firstpage);
ceTe.DynamicPDF.PageElements.Forms.TextField txtField = new ceTe.DynamicPDF.PageElements.Forms.TextField("txt1", 0, 0, 200, 40);
ceTe.DynamicPDF.PageElements.Forms.TextField txtField1 = new ceTe.DynamicPDF.PageElements.Forms.TextField("txt2", 0, 50, 200, 40);
firstpage.Elements.Add(txtField);
firstpage.Elements.Add(txtField1);
float yPos = txtField1.Y + txtField1.Height + 10;
float height = firstpage.Dimensions.Body.Height - yPos;
//Create TableA...................
Table2 tableA = new Table2(0, yPos, 200, height);
// Add columns to the table
tableA.Columns.Add(100);
// Add rows to the table and add cells to the rows
for (int i = 0; i < 1000; i++)
{
Row2 row1 = tableA.Rows.Add();
row1.Cells.Add("Item::" + (i + 1));
}
// Add the table to the page
firstpage.Elements.Add(tableA);
tableA = tableA.GetOverflowRows();
do
{
tableA.Height = tableA.GetRequiredHeight();
Page page = new Page();
document.Pages.Add(page);
tableA.Y = 0;
if (tableA.Height > page.Dimensions.Body.Height)
{
tableA.Height = page.Dimensions.Body.Height;
}
else
{
tableA.Height = tableA.GetRequiredHeight();
}
page.Elements.Add(tableA);
tableA = tableA.GetOverflowRows();
}while (tableA != null);
// Save the PDF
string pdfFilePath = @"C:\Temp\MyTable.pdf";
document.Draw(pdfFilePath);
Thanks,
ceTe Software Support Team