I am a new user of spire PDF (ASP NET / VB.NET)
I succeed to create a PDF document with a grid on several pages.
I did not find how to add a page break.
By example, after 10 rows, I would like that the grid resume on the next page.
With my fist try, there is page break but the first 10 rows are repeated on the seconde page with the end of the data.
page 1 : row 1 to 10
page 2 and next : row 1 to end
- Code: Select all
Protected Sub Bt_grid_Click(sender As Object, e As EventArgs) Handles Bt_grid.Click
Dim monPDF As New Spire.Pdf.PdfDocument()
Dim section = monPDF.Sections.Add
Dim unePage As PdfPageBase = Nothing
Dim result As PdfLayoutResult = Nothing
Dim nbcolonnes As Integer = 10
Dim grid As New PdfGrid()
section.PageSettings.Orientation = PdfPageOrientation.Landscape
unePage = section.Pages.Add()
Grid.Columns.Add(2) ' 2 colonnes
Dim nb_ligne_entete As Integer = 2
Dim entete(nb_ligne_entete) As PdfGridRow
'entête du tableau
Dim entete2 As PdfGridRow
For i As Integer = 0 To nb_ligne_entete - 1 ' 2 lignes d'entête sans bordure, pas forcément nécessaire
entete(i) = grid.Headers.Add(1)(i)
Next
entete2 = grid.Headers.Add(1)(2) ' entêtes des données la ligne suivante
entete(0).Cells(0).Value = "entete 0 row 0"
entete(0).Cells(1).Value = "entete 1 row0"
entete(1).Cells(1).Value = "entete 1 row 1"
grid.RepeatHeader = True
'loop to fill the grid :
For i As Integer = 1 To 200
Dim contenuRow As PdfGridRow = grid.Rows.Add()
contenuRow.Cells(0).Value = "Valeur " & i
' here, i want to add a page / pager break
If i = 10 Then
result = grid.Draw(unePage, New PointF(1, 1))
unePage = section.Pages.Add()
End If
Next
result = grid.Draw(unePage, New PointF(1, 1))
monPDF.SaveToHttpResponse("Grille.pdf", HttpContext.Current.Response, HttpReadType.Save)
End Sub
My question : how add a page break ?
Thanks.