Auto Page breaks added with Manual page breaks in Aspose.Cells

I’m encountering an issue with page breaks while working with Aspose.Cells. I’m manually adding horizontal page breaks after every 50 rows using HorizontalPageBreaks.Add(). On first page, first page break happens at 50th row. On the second page (which has 4 to 6 rows of slightly higher height), I’ve noticed that automatic page breaks (97th row) are being inserted a couple of rows above the manual page break (100th row).
I’m wondering why these automatic page breaks are being added and if there’s any way to prevent them from being applied? It seems to interfere with the layout I’m trying to achieve.

Any suggestions or sample code would be greatly appreciated!

Thank you in advance.

@dorjee,

There are a number of PageSetup options which might affect the page break settings. For example, when you use page scaling (%) or set the fit to pages options, the page break settings might be affected. Could you please provide a sample (runnable) code and sample Excel files (please zip the files prior to attaching here) to reproduce the issue on our end? We will check your issue.

PS. Please try using the latest version if you are not already using it.

@dorjee
There seems to be no good way.
After exceeding one page height, Excel will automatically add a page break.
If fitting one page height(PageSetup.FitToPagesTall), page breaks will not work.
If the areas you need to print separately are discontinuous, we can set discontinuous printing areas(PageSetup.PrintArea = “A1:H50,A52:H100”) and fit to one page tall(PageSetup.FitToPagesTall = 1). But if areas are discontinuous, MS Excel will merge them even we add them separately.