Closed ChipM0nk closed 1 year ago
Hi @ChipM0nk,
Regarding the Stacked Header: You need to set the corresponding text in the StackedHeaderCell.text property. As widgets can’t be exported to PDF, set this property to give the corresponding text while exporting the SfDataGrid to PDF. Please refer to the following code snippet and sample.
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
body: Column(
children: [
ElevatedButton(
onPressed: () => exportDataGridToPDF(),
child: const Text("Export to PDF")),
Expanded(
child: SfDataGrid(
key: key,
source: employeeDataSource,
stackedHeaderRows: [
StackedHeaderRow(
cells: [
StackedHeaderCell(
text: 'Stacked Header',
columnNames: ['id', 'name', 'designation', 'salary'],
child: const Text("Stacked Header"),
),
],
),
],
columns: getColumns,
),
),
],
),
),
);
}
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Sample-1234621677
Regarding the Footer: Currently, the SfDataGrid only provides support for exporting the cell content to a PDF document. Also, DataGrid doesn’t have support for exporting the footer to a PDF document. You can add the footer using the PDF document footer. Refer to the following UG document for the PDF footer
UG Document: https://help.syncfusion.com/flutter/pdf/working-with-headers-and-footers
Thanks for the response and sample
SfDataGrid PDF export is not displaying the StackedHeader and Footer in Flutter Web.
Below is the sample code I wrote with Print Button.