【发布时间】:2014-04-22 14:19:48
【问题描述】:
我正在使用 ItextSharp 创建 PDF 文档,但在创建每个页面上重复的标题表时遇到问题。
我有一个以这种方式创建此表布局的函数:
public PdfPTable createTabHeader()
{
PdfPTable tableIntestazione = new PdfPTable(2);
PdfPCell cell = new PdfPCell(new Phrase("Rendicontazione"));
cell.Border = 0;
cell.BorderWidthBottom = 1;
cell.BorderColorBottom = BaseColor.LIGHT_GRAY;
cell.PaddingTop = 45;
tableIntestazione.AddCell(cell);
cell = new PdfPCell();
iTextSharp.text.Image imgLogo = iTextSharp.text.Image.GetInstance(ConfigurationManager.AppSettings["imgLogo"]);
imgLogo.ScalePercent(10);
imgLogo.Alignment = iTextSharp.text.Image.ALIGN_RIGHT;
cell.AddElement(imgLogo);
cell.Border = 0;
cell.HorizontalAlignment = 2;
cell.BorderWidthBottom = 1;
cell.BorderColorBottom = BaseColor.LIGHT_GRAY;
tableIntestazione.AddCell(cell);
tableIntestazione.HeaderRows = 1;
return tableIntestazione;
}
我在网上读到“HeaderRows”属性允许在每个页面上显示表格标题,但在我的情况下,它完全隐藏了这个表格。 你能帮帮我吗?
【问题讨论】: