I am using SfDataGrid with pagination and I would like to export all data not only the current page but I couldn't achieve it correctly.
My current code is below.
final excel.Workbook workbook = excel.Workbook();
for (var i = 0; i < viewModel.pagedRows.length; i++) {
final page = viewModel.pagedRows[i];
final excel.Worksheet worksheet = i == 0 ? workbook.worksheets[0] : workbook.worksheets.addWithName(i.toString());
key.currentState!.exportToExcelWorksheet(worksheet, rows: page);
}
final List<int> bytes = workbook.saveAsStream();
workbook.dispose();
writeToFile('DataGrid.xlsx', bytes);
Share.shareFiles([await getFilePath('DataGrid.xlsx')],
subject: 'Exported Excel',
mimeTypes: ['application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.ms-excel']);
With this code, I can correctly export paginated data to related worksheets. But the problem is summary rows because the export system uses the current visible datagrid's page's summary values while exporting and this causes data errors in the exported file.
I think I should use `DataGridToExcelConverter` and intervene exporting process however I didn't find a way to do it.