I need some help with an example you could give me. I want to know how to add style (cell background color) to a excel exported file using kendo-grid-exce
The example here does exactly that:
public onExcelExport(e: any): void {
const rows = e.workbook.sheets[0].rows;
// align multi header
rows[0].cells[2].hAlign = 'center';
// set alternating row color
let altIdx = 0;
rows.forEach((row) => {
if (row.type === 'data') {
if (altIdx % 2 !== 0) {
row.cells.forEach((cell) => {
cell.background = '#aabbcc';
});
}
altIdx++;
}
});
}