excelExport
Fired when the user clicks the "Export to Excel" toolbar button.
Event Data
e.sender kendo.ui.Grid
The widget instance which fired the event.
e.data Array
The array of data items used to create the Excel workbook. Available since version 2014.3.1205.
e.workbook kendo.ooxml.Workbook
The Excel workbook configuration object. Used to initialize a kendo.ooxml.Workbook
class. Modifications of the workbook will reflect in the output Excel document.
When the Kendo UI Grid is configured for excel export, the workbook is extended internally with a
fileName
property which is used when the file is saved. The default name is "Export.xlsx". See the example below which shows how to change the name of the exported document.
e.preventDefault Function
If invoked the grid will not save the generated file.
Example - subscribe to the "excelExport" event during initialization
<div id="grid"></div>
<script>
$("#grid").kendoGrid({
toolbar: ["excel"],
columns: [
{ field: "name" }
],
dataSource: [
{ name: "Jane Doe"},
{ name: "John Doe"}
],
excelExport: function(e) {
e.workbook.fileName = "Grid.xlsx";
}
});
var grid = $("#grid").data("kendoGrid");
grid.saveAsExcel();
</script>
Example - subscribe to the "excelExport" event after initialization
<div id="grid"></div>
<script>
$("#grid").kendoGrid({
toolbar: ["excel"],
columns: [
{ field: "name" }
],
dataSource: [
{ name: "Jane Doe"},
{ name: "John Doe"}
]
});
var grid = $("#grid").data("kendoGrid");
grid.bind("excelExport", function(e) {
e.workbook.fileName = "Grid.xlsx";
});
grid.saveAsExcel();
</script>