【发布时间】:2017-03-17 01:31:16
【问题描述】:
我创建了一个 PdfPTable 并使用 WriteSelectedRows 编写表格,每当 HTML 内容很大并占用两页时,表格就会写入第二页而不是第一页。如果内容本身是一页,那么表格将正确写入第一页。
无论页数如何,请帮助我在第 1 页写下表格。
PdfPCell c = new PdfPCell(ImageHeader, true);
c.HorizontalAlignment = Element.ALIGN_LEFT;
c.FixedHeight = cellHeight;
c.Border = PdfPCell.NO_BORDER;
head.AddCell(c);
c = new PdfPCell(new Phrase("somePhrase", fontintestazione));
c.Border = PdfPCell.NO_BORDER;
head.AddCell(c);
c = new PdfPCell(new Phrase("someTextBlah", fontRight));
c.Border = PdfPCell.NO_BORDER;
c.HorizontalAlignment = 1;
c.BackgroundColor = new BaseColor(70, 130, 180);
head.AddCell(c);
head.WriteSelectedRows(0, -1, 10, page.Height - cellHeight + head.TotalHeight -30, writer.DirectContent);
以上代码是我要添加的示例表。
【问题讨论】: