Posted 9 September 2025, 6:54 am EST
Hi,
Thank you for sharing the updated sample project. We were able to reproduce the behavior you mentioned. The pagination in DsExcel appears to be working correctly and the behavior you observe is due to insufficient space on the page to accommodate all of the data, which naturally causes some content to break onto a new page.
This does not seem to be an issue with the KeepTogether setting, as it is designed to “keep the cell and its descendants on the same page as much as possible while paginating vertically", provided that one page can fit all the content - which, in your case, it cannot.
We also verified the behavior by exporting the processed workbook to .xlsx, and the pagination worked as expected, breaking the content across different sheets. Exporting a sheet from MS Excel to PDF showed similar behavior, where part of the content is shifted to a new page because one page cannot fit everything.
The best solution for you would be to either reduce the size of the rows in your template so they fit on one page, or use the worksheet.PageSetup.BestFitRows = true; option, allowing DsExcel to adjust the rows automatically.
Attachment: template_cust.zip
Best Regards,
Kartik