如果我将行_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);
}