【发布时间】:2019-07-16 10:58:08
【问题描述】:
我有一个包含 2 个单元格的 PDFPTable。 第一个有 1 行。第二个有 100 行。 第二个单元格进入新页面,但我希望它在第一个单元格之后开始。
Dim cFile As String = "c:\temp\ccc.pdf"
Dim doc = New Document(PageSize.A4)
Dim writer As PdfWriter = PdfWriter.GetInstance(doc, New FileStream(cFile, FileMode.Create))
doc.Open()
Dim oPdf As PdfContentByte = writer.DirectContent
Dim baseFont As BaseFont = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, False)
Dim baseFontBold As BaseFont = BaseFont.CreateFont(BaseFont.TIMES_BOLD, BaseFont.CP1252, False)
Dim courier As New Font(baseFont, 12)
Dim bold As New Font(baseFontBold, 12, Font.Bold, Color.RED)
Dim tb0 As New PdfPTable(1)
Dim cell0 As New PdfPCell
Dim ch0 As New Chunk("AA")
Dim ph0 As New Phrase(ch0)
cell0.AddElement(ph0)
tb0.AddCell(cell0)
'Dim tb1 As New PdfPTable(1)
Dim cell1 As New PdfPCell
For i = 1 To 100
Dim ch1 As New Chunk("CIAO")
Dim ph1 As New Phrase(ch1)
cell1.AddElement(ph1)
Next
tb0.AddCell(cell1)
doc.Add(tb0)
'doc.Add(tb1)
doc.Close()
我希望第二个单元格保留在第一页,但实际转到新页面
【问题讨论】:
-
我的回答对您有足够的帮助吗?还是还有未解决的问题?