Fix paging when generating spreadsheet