我们正在用 DynamicPDF 写一个表格,但我们想对行进行“分组”,这样在组的中间就不会出现分页符。这些组从一到六行不等。有没有人找到办法做到这一点?这是我们的代码:
// Create a PDF Document
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);
row.Cells.Add("Row #" + i);
row.Cells.Add("Item");
}
// 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);