I have been looking in the documents but haven't found anything to address this situation. I am wondering if there is a way to handle the overflow or a row if the ActualRowHeight is greater than the height of the table. I modified an example from the help file to show this situation. Right now it simply cuts off the remaining text in the row.
Table2 table = new Table2(0, 0, 200, 700);
// Add columns to the table
table.Columns.Add(100);
table.Columns.Add(100);
// This loop populates the table
for (int i = 1; i <= 400; i++)
{
Row2 row = table.Rows.Add(20);
row.Cells.Add("Row #" + i);
row.Cells.Add("Line 1\n\nLine 2\n\nLine 3\n\nLine4\n\nLine 5\n\nLine 6\n\nLine 7\n\nLine 8\n\nLine 9\n\nLine 10\n\nLine 11\n\nLine 12\n\nLine 13\n\nLine 14\n\nLine 15\n\nLine 16\n\nLine 17\n\nLine 18\n\nLine 19\n\nLine 20\n\nLine 21\n\nLine 22\n\nLine 23\n\nLine 24\n\nLine 25\n\nLine 26\n\nLine 27\n\nLine 28\n\nLine 29\n\nLine 30");
float height = row.ActualRowHeight;
}
// This loop outputs the table to as many pages as is required
do
{
Page page = new Page();
document.Pages.Add(page);
page.Elements.Add(table);
table = table.GetOverflowRows();
} while (table != null);
// Save the PDF
document.DrawToWeb("MyDocument.pdf");
ActualRowHeight greater than table height
Re: ActualRowHeight greater than table height
Forum member · Mar 13, 2013I just found the splittable property looking through the v6 threads. I think that will solve my issue.
Re: ActualRowHeight greater than table height
Support · Mar 13, 2013Hello,
Yes, if you set the Splittable property of the cell of the row to true then the cell contents will be overflowed to next page and this will work for you. Below is the sample code.
Document document = new Document();
Table2 table = new Table2(0, 0, 200, 700);
// Add columns to the table
table.Columns.Add(100);
table.Columns.Add(100);
// This loop populates the table
for (int i = 1; i <= 400; i++)
{
Row2 row = table.Rows.Add(20);
Cell2 cell1= row.Cells.Add("Row #" + i);
cell1.Splittable = true;
Cell2 cell2=row.Cells.Add("Line 1\n\nLine 2\n\nLine 3\n\nLine4\n\nLine 5\n\nLine 6\n\nLine 7\n\nLine 8\n\nLine 9\n\nLine 10\n\nLine 11\n\nLine 12\n\nLine 13\n\nLine 14\n\nLine 15\n\nLine 16\n\nLine 17\n\nLine 18\n\nLine 19\n\nLine 20\n\nLine 21\n\nLine 22\n\nLine 23\n\nLine 24\n\nLine 25\n\nLine 26\n\nLine 27\n\nLine 28\n\nLine 29\n\nLine 30");
cell2.Splittable = true;
float height = row.ActualRowHeight;
}
// This loop outputs the table to as many pages as is required
do
{
Page page = new Page();
document.Pages.Add(page);
page.Elements.Add(table);
table = table.GetOverflowRows();
} while (table != null);
// Save the PDF
document.Draw("C:\\MyDocument.pdf");
Thanks,
ceTe Software Support Team.