-
Notifications
You must be signed in to change notification settings - Fork 906
Closed
Labels
data gridData grid componentData grid component
Description
I am using SFDataGrid in one of my projects and facing an issue with Stacked Headers.
In my project, I am using both Excel and pdf exports. Excel export is working tremendously but PDF export has a problem with stacked headers.
This is the result of the Excel export and this is correct.

But this is the result of PDF export, as you can see stacked headers were omitted.

here is the PDF export code
PdfGrid pdfGrid = key.currentState!.exportToPdfGrid(
converter: converter,
rows: page,
excludeColumns: excludeColumns,
fitAllColumnsInOnePage: true,
cellExport: (details) async {
details.pdfCell.style.font = PdfTrueTypeFont(fontBytes, 6);
});Converter code
class CustomDataGridToPdfConverter extends DataGridToPdfConverter {
int page = 0;
@override
PdfGrid exportToPdfGrid(SfDataGrid dataGrid, List<DataGridRow>? rows) {
(dataGrid.source as LogbookViewModel).silentHandlePageChange(page == 0 ? 0 : page - 1, page);
return super.exportToPdfGrid(dataGrid, rows);
}
@override
Object? getCellValue(GridColumn column, DataGridRow row) {
var value = super.getCellValue(column, row);
if (value.toString() == "0" || value.toString() == "00:00") {
return "";
}
return value;
}
@override
void exportColumnHeader(SfDataGrid dataGrid, GridColumn column, String columnName, PdfGrid pdfGrid) {
var label = "";
if (column.label is Text) {
label = (column.label as Text).data!;
} else if (column.label is Center) {
label = ((column.label as Center).child as Text).data!;
} else {
label = (((column.label as Padding).child as Center).child as Text).data!;
}
super.exportColumnHeader(dataGrid, column, label, pdfGrid);
}
}I couldn't find what is wrong with PDF export.
Metadata
Metadata
Assignees
Labels
data gridData grid componentData grid component