Posted 11 January 2022, 1:13 pm EST
Just a quick question, is it possible to export a grid without its content, just the columns headers? To be used as template for imports to the grid.
Forums Home / Wijmo / General Discussion
Posted by: germiep.fernandez on 11 January 2022, 1:13 pm EST
Posted 11 January 2022, 1:13 pm EST
Just a quick question, is it possible to export a grid without its content, just the columns headers? To be used as template for imports to the grid.
Posted 11 January 2022, 11:39 pm EST
Hello,
Yes, it is possible. You may update the onSaved parameter of the FlexGridXlsxConverter and remove the rows from the sheet except the columnHeader row. Please refer to the code snippet and sample link below demonstrating the same:
save() {
wjcGridXlsx.FlexGridXlsxConverter.saveAsync(
this.flex,
{
includeColumnHeaders: true,
includeCellStyles: false,
},
'',
(_, workbook) => {
workbook.sheets[0].rows.length = 1; // remove all the rows except columnHeader row
workbook.saveAsync('FlexGrid.xlsx');
}
);
}
Sample link: https://stackblitz.com/edit/angular-dwctjg?file=src%2Fapp%2Fapp.component.ts
Regards