{ field: 'Mon', headerText: 'Month', template: "${Mon.getMonth()}.${Mon.getFullYear()}" }
How can I tune the export to Excel for this column?
Apparently, the export should take the template from the grid.
See attach file...
Regards, Andrew Kabanets.
|
let grid: Grid = new Grid({
dataSource: productData.splice(0, 20),
. . .
columns: [
. . .
]
});
grid.appendTo('#Grid');
grid.toolbarClick = (args: ClickEventArgs) => {
if (args.item.id === 'Grid_excelexport') {
grid.excelExport(getExcelExportProperties());
}
};
};
function getExcelExportProperties(): any {
return {
header: {
headerRows: 7,
rows: [
{
index: 3, //row index
cells: [
{ index: 1, colSpan: 2, value: 'Grid Action', style: { fontColor: '#C67878', fontSize: 15, bold: true } },
{ index: 5, value: 'Filter Type', style: { fontColor: '#C67878', bold: true }, width: 150 }
]
},
{
index: 4, //row index
cells: [
{ index: 1, colSpan: 2, value: "Filtering"},
{ index: 5, value: grid.filterSettings.type, width: 150 } //cell index, value and width
]
},
]
}
}
};
} |
|
import { L10n } from '@syncfusion/ej2-base';
L10n.load({
'de-DE': {
'grid': {
'Add': 'add',
'Edit': 'edit',
'Cancel': 'cancel',
'Delete': 'Delete',
'Update': 'update',
'Excelexport':'excel',
'Pdfexport':'pdf',
'Csvexport':'csv'
},
'pager': {
}
}
});
let grid: Grid = new Grid(
{
dataSource: orderData.splice(0, 200),
locale: 'de-DE',
toolbar: ['add','edit','delete','excelexport', 'pdfexport', 'csvexport'],
pageSettings: { pageCount: 5 },
columns: [
. . .
]
});
grid.appendTo('#Grid'); |
|
let grid: Grid = new Grid(
{
dataSource: orderData.splice(0, 200),
allowExcelExport: true,
toolbar: ['excelexport', 'pdfexport', 'csvexport'],
columns: [
. . .
],
excelQueryCellInfo : customiseCell
});
grid.appendTo('#Grid');
grid.toolbarClick = (args: ClickEventArgs) => {
if (args.item.id === 'Grid_excelexport') {
grid.excelExport();
}
};
function customiseCell(args: ExcelQueryCellInfoEventArgs ) {
if(args.column.field === "OrderDate"){
args.value=args.data.OrderDate.getMonth().toString();
}
}
|