Insert Rows When Exporting the Grid to Excel
Environment
Product | Progress® Kendo UI® Grid for jQuery |
Product Version | 2017.2.621 |
Description
How can I intercept the Excel export of the Kendo UI Grid and add data to the exported file?
Solution
When the excelExport
event is fired, access the configuration object of the Excel workbook and add rows to its sheets in the e.workbook
property.
function excelExport(e) {
console.log(e.workbook.sheets[0].rows)
e.workbook.sheets[0].rows.unshift(
{
cells: [
{
value: "Some content",
background: "#7a7a7a",
colSpan: 2,
color: "#fff",
rowSpan: 2
}
]
} )
}