如果我将该行添加_table.HeaderRow = 1;
到我的代码中,则表格不在 PDF 文档中。但是如果我删除它,桌子就在那里。我需要在每一页上重复表格标题,但尝试时无法显示表格。
protected void StartTableWithOptions(float width, float leadSpacing, params float[] sizes)
{
_table = new PdfTable(sizes.Length) { SpacingBefore = leadSpacing, KeepTogether = true, SplitRows = true, SplitLate = true};
_table.HeaderRow = 1;
if (width > 0)
{
_table.TotalWidth = width;
}
else
{
_table.WidthPercentage = 100;
}
_table.SetWidths(sizes);
_table.HorizontalAlignment = Element.ALIGN_CENTER;
_table.DefaultCell.Border = Rectangle.BOX;
_table.DefaultCell.BorderColor = new BaseColor(0xAF, 0xAF, 0xAF);
}