We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose pdf set default table min height for every page

Hi,

I want to set table min heigth so if IsFirstRowRepeated=true next pdf page has always the same height of that table.

Thanks, Rolly

Hi Rolly,


Thanks for your inquiry. Please use new generator (Aspose.Pdf) instead old generator(Aspose.Pdf.Generator), it is more improved and efficient. It does not has Table header height issue. Please check following sample code snippet and working with tables in new DOM. It will resolve the issue.

// Load source PDF document<o:p></o:p>

Aspose.Pdf.Document doc = new Aspose.Pdf.Document();

Aspose.Pdf.Page page = doc.Pages.Add();

// Initializes a new instance of the Table

Aspose.Pdf.Table table = new Aspose.Pdf.Table();

table.RepeatingRowsCount = 3;

// Set the table border color as LightGray

table.Border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, .5f, Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightGray));

// set the border for table cells

table.DefaultCellBorder = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, .5f, Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightGray));

// create a loop to add 10 rows

for (int row_count = 1; row_count < 300; row_count++)

{

// add row to table

Aspose.Pdf.Row row = table.Rows.Add();

// add table cells

row.Cells.Add("Column (" + row_count + ", 1)");

row.Cells.Add("Column (" + row_count + ", 2)");

row.Cells.Add("Column (" + row_count + ", 3)");

}

// Add table object to first page of input document

page.Paragraphs.Add(table);

// Save updated document containing table object

doc.Save(myDir + "document_with_table.pdf");

Please feel free to contact us for any further assistance.


Best Regards,