Hello,
I have a problem using method Table.IsBroken = False with Aspose.Pdf .Net 20.5 : I generate two tables and the second one not fit entirely on the first page.
If I use table.IsBroken = True, the second table is split, that is ok. But what I want it is my second table go entirely on next page : so I use table.IsBroken = False. But my second table is split on the first page, and no rows on the next page (The rest of the table has disappeared).
How can I have my second table entirely on next page ? In further version of Aspose.Pdf (9.0.0) the IsBroken method did not split my second table which send entirely on next page.
Thanks for your answer.
Below a sample code :
Private Sub TestTablesBrokenOrNot(brokenParam As Boolean) 'Instantiate an object PDF class Dim pdf = New Document() 'Add the section to PDF document sections collection Dim page = pdf.Pages.Add() 'Instantiate a table object Dim table1 = New Table() table1.Margin.Top = 20 'Add the table in paragraphs collection of the desired section page.Paragraphs.Add(table1) 'Set with column widths of the table table1.ColumnWidths = "100 100 100" 'Set default cell border using BorderInfo object table1.DefaultCellBorder = New Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 0.1F) 'Set table border using another customized BorderInfo object table1.Border = New Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 1.0F) table1.IsBroken = False 'Create MarginInfo object And set its left, bottom, right And top margins Dim margin = New Aspose.Pdf.MarginInfo() margin.Top = 5.0F margin.Left = 5.0F margin.Right = 5.0F margin.Bottom = 5.0F 'Set the default cell padding to the MarginInfo object table1.DefaultCellPadding = margin For rowCounter = 0 To 25 Dim row1 = table1.Rows.Add() row1.Cells.Add("col " + rowCounter.ToString() + ", 1") row1.Cells.Add("col " + rowCounter.ToString() + ", 2") row1.Cells.Add("col " + rowCounter.ToString() + ", 3") Next Dim table2 = New Table() table2.Margin.Top = 20 'Add the table in paragraphs collection of the desired section page.Paragraphs.Add(table2) 'Set with column widths of the table table2.ColumnWidths = "100 100 100" 'Set default cell border using BorderInfo object table2.DefaultCellBorder = New Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 0.1F, Aspose.Pdf.Color.Green) 'Set table border using another customized BorderInfo object table2.Border = New Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 1.0F, Aspose.Pdf.Color.Green) table2.IsBroken = brokenParam 'Set the default cell padding to the MarginInfo object table2.DefaultCellPadding = margin For rowCounter = 0 To 13 Dim row1 = table2.Rows.Add() row1.Cells.Add("col " + rowCounter.ToString() + ", 1") row1.Cells.Add("col " + rowCounter.ToString() + ", 2") row1.Cells.Add("col " + rowCounter.ToString() + ", 3") Next Dim pdfFileName = If(brokenParam, $"C:\temp\testTableBrokenOK.pdf", $"C:\temp\testTableNotBrokenUncomplete.pdf") pdf.Save(pdfFileName) Process.Start(pdfFileName) End Sub
When I call this Sub, brokenParam is set to “False”
See the result file in attachment.testTableNotBrokenUncomplete.pdf (3.6 KB)