同時設定 RepeatingRowsCount 及 IsRowBroken = True 時,會導致跨頁標題沒有文字
PicQ5.png (6.1 KB)
PDFQ5.pdf (7.0 KB)
Public Sub Gen_PDF_Q5()
Dim RowCount As Integer = 70
Dim ColCount As Integer = 5
AsposeFunc.AsposePDFLicense_20240906()
Dim pDoc As New Aspose.Pdf.Document()
Dim pPages As Aspose.Pdf.PageCollection = pDoc.Pages
Dim pPage As Aspose.Pdf.Page = pPages.Add()
pPage.SetPageSize(Aspose.Pdf.PageSize.A4.Width, Aspose.Pdf.PageSize.A4.Height)
Dim PageMargin As New Aspose.Pdf.MarginInfo With {.Top = 25, .Left = 25, .Right = 25, .Bottom = 25}
Dim pPageInfo As Aspose.Pdf.PageInfo = pPage.PageInfo
pPageInfo.Margin = PageMargin
Dim pTable As New Aspose.Pdf.Table With {.ColumnWidths = "20% 20% 20% 20% 20%"}
pPage.Paragraphs.Add(pTable)
pTable.RepeatingRowsCount = 3
Dim Border As New Aspose.Pdf.BorderInfo With {
.Top = New Aspose.Pdf.GraphInfo With {.LineWidth = 0.5},
.Left = New Aspose.Pdf.GraphInfo With {.LineWidth = 0.5},
.Right = New Aspose.Pdf.GraphInfo With {.LineWidth = 0.5},
.Bottom = New Aspose.Pdf.GraphInfo With {.LineWidth = 0.5}
}
Dim pRows As Aspose.Pdf.Rows = pTable.Rows
For iRow As Integer = 0 To RowCount - 1
Dim pRow As Aspose.Pdf.Row = pRows.Add()
pRow.IsRowBroken = True
Dim pCells As Aspose.Pdf.Cells = pRow.Cells
For iCol As Integer = 0 To ColCount - 1
Dim R1C1 As String = "R" & iRow + 1 & "C" & iCol + 1
Dim pCell As Aspose.Pdf.Cell = pCells.Add(R1C1)
pCell.Border = Border
Next
Next
pDoc.Save("X:\Coding\PDFQ5.pdf")
End Sub