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

Free Support Forum - aspose.com

Different Page Breaks between Aspose and Excel

Dear Aspose Support Team

The attached file FromAspose.xlsx has been created with Aspose.Cells. According to the getPrintingPageBreaks(…) API, the second page is up to and including cell J59. A ‘hard’ page break was added after this row (we need to insert dynamic titles after each page break).
When opening the file in Excel, however, it shows a ‘soft’ page break already one row before. After saving the file with Excel (see SavedWithExcel.xlsx in attachment), then also getPrintingPageBreaks(…) reports the second page only up to cell J58.
Interestingly, also some of the row heights changed (for some of the units) when opening/saving the file with Excel. See Comparison.xlsx for a comparison of the page breaks and row heights. The below code was used to retrieve the page breaks and row heights:

package support.pagebreak;

import com.aspose.cells.CellArea;
import com.aspose.cells.Cells;
import com.aspose.cells.ImageOrPrintOptions;
import com.aspose.cells.License;
import com.aspose.cells.Workbook;
import com.aspose.cells.Worksheet;

public class PageBreak {

	private static final String PROBLEM_FILE = "src\\support\\pagebreak\\FromAspose.xlsx";
	private static final String PROBLEM_FILE_SAVED_EXCEL = "src\\support\\pagebreak\\SavedWithExcel.xlsx";
	private static Worksheet worksheet;
	private static Cells cells;

	public static void main(String[] args) throws Exception {
		if (!License.isLicenseSet())
			new License().setLicense("Aspose.Cells.lic");

		Workbook workbook = new Workbook(PROBLEM_FILE);
		worksheet = workbook.getWorksheets().get(0);

		workbook = new Workbook(PROBLEM_FILE_SAVED_EXCEL);
		worksheet = workbook.getWorksheets().get(0);

	private static void printInfo() throws Exception {
		for (CellArea a : worksheet.getPrintingPageBreaks(new ImageOrPrintOptions())) {

		cells = worksheet.getCells();
		for (int row = 0; row <= 63; row++) {
			System.out.println(cells.getRowHeight(row) + "//" + cells.getRowHeightPixel(row) + "//" + cells.getRowHeightInch(row));

My main concern here is the page break. I need stable page breaks, that are the same as calculated by Aspose even when I open / save the document in Excel. How can I achieve this?

PageBreak.zip (29.1 KB)

We are currently using Aspose Cells for Java version 20.6.3.

Thank you in advance for your feedback.

We have observed this issue and logged in our database for further investigation. We will write back here once any update is ready to share regarding this issue.

CELLSJAVA-43239 - Different page breaks detected for files created by Aspose.Cells and MS Excel


As you said “some of the row heights changed (for some of the units) when opening/saving the file with Excel”, we can see the custom row height in points changes from 20, 5, 23 to 20.1, 5.1, 23.1. This causes the different page breaks. We also don’t know why Microsoft Excel changes the custom row height.

Is it possible you set the row height to 20.1, 5.1, 23.1 instead of 20, 5, 23 while generating the xlsx excel file?

Weird, Excel seems to do this pretty consistently.

For the time being we are going with your proposal and ‘adjust’ the values we use for row heights. It solved the issue for this specific file. Thank you. We will let you know in case we run into further issues due to this.


Thanks for following the suggested workaround and good know that your issue is sorted out now.

Should you have further queries or issue, feel free to write us back, we will assist you soon.