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

Free Support Forum - aspose.com

Header with rowspan not working properly

We are currently using Aspose.PDF 20.9 for java. We faced a problem with having a header cell with rowspan in the table. The first 2 rows should be repeated on all pages. However, setRepeatingRowsCount(2) method splits that cell into 2 cells.

Below you can find an example

	Document doc = new Document();
	//Create the section in the PDF object
	Page page = doc.getPages().add();

	//Instantiate a table object
	Table tab = new Table();
	//Add the table in paragraphs collection of the desired section

	//Set default cell border using BorderInfo object
	tab.setDefaultCellBorder(new com.aspose.pdf.BorderInfo(com.aspose.pdf.BorderSide.All, 0.1F));

	//Set table border using another customized BorderInfo object
	tab.setBorder(new com.aspose.pdf.BorderInfo(com.aspose.pdf.BorderSide.All, 1F));


	//Create rows in the table and then cells in the rows
	Row row1 = tab.getRows().add();
	Cell col1 = row1.getCells().add("header cell with rowspan");
	row1.getCells().add("header upper cell");
	Row row2 = tab.getRows().add();
	row2.getCells().add("header lower cell");
	for (int row_count = 1; row_count < 500; row_count++) {
		Row row = tab.getRows().add();
		row.getCells().add("Column (" + row_count + ", 1)");
		row.getCells().add("Column (" + row_count + ", 2)");
	//Save the PDF
	doc.save(dataDir + "ResultantFile.pdf");

Attached you can find the resulting pdf. and 2 screenshots
ResultantFile.pdf (62.5 KB)
pic2.png (59.2 KB)
pic1.png (51.8 KB)


We were able to notice in our environment that row span was not working correctly while testing the scenario with Aspose.PDF for Java 20.9. Therefore, we have logged an issue as PDFJAVA-39877 in our issue tracking system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.