Hi Ed,
Greetings from Syncfusion support.
The Grid custom content and styles defined through column template will not be exported to excel file. This is because the Grid excel export draws value on the exported document from the Grid data source and so it does not export custom content by default.
However you can export the text content defined in the column template by setting its corresponding value to the value property of the excelQueryCellInfo(Triggers for each cell before exporting to excel) event.
This is demonstrated in the below code snippet for your reference,
|
// Grid’s toolbarClick event handler
toolbarClick(args: ClickEventArgs): void {
if (args.item.text === 'Excel Export') {
this.index = 0;
this.grid.excelExport();
}
}
// Grid's excelQueryCellInfo event handler
exportQueryCellInfo(args: ExcelQueryCellInfoEventArgs): void {
if (args.column.headerText === 'Index') {
// Here you can provide the template text content for the Grid cell
args.value = "" + this.index;
this.index++;
}
} |
We have prepared a sample based on this for your reference. You can find it below,
Please get back to us if you require any further assistance.
Regards,
Sujith R