New to Kendo UI for jQuery? Start a free 30-day trial

Fired when the saveAsExcel method is called, before the file is saved.

The PivotGridV2 exports the values of the data cells and does not apply the dataCellTemplate. To change the exported values or styles, modify the workbook in the event handler.

Event Data

e.sender kendo.ui.PivotGridV2

The widget instance which fired the event.

e.data Array

The rows of the first sheet of the generated workbook.

e.workbook Object

The Excel workbook configuration object. Used to initialize a kendo.ooxml.Workbook class. Modifications of the workbook will reflect in the output Excel document. The header rows have a type of "header" and the data rows have a type of "data". Each data row starts with its row header cells and ends with the data cells.

e.preventDefault Function

If invoked the PivotGridV2 will not save the generated file.

<div id="pivotgrid"></div>
<script>
$("#pivotgrid").kendoPivotGridV2({
    excelExport: function(e) {
        e.workbook.fileName = "PivotGridV2.xlsx";
    },
    height: 550,
    columnWidth: 120,
    dataSource: {
        type: "xmla",
        columns: [{ name: "[Date].[Calendar]", expand: true }, { name: "[Geography].[City]" } ],
        rows: [{ name: "[Product].[Product]" }],
        measures: ["[Measures].[Internet Sales Amount]"],
        transport: {
            connection: {
                catalog: "Adventure Works DW 2008R2",
                cube: "Adventure Works"
            },
            read: 'https://demos.telerik.com/service/v2/olap/msmdpump.dll'
        }
    }
});
var pivotgrid = $("#pivotgrid").data("kendoPivotGridV2");
pivotgrid.saveAsExcel();
</script>
<div id="pivotgrid"></div>
<script>
$("#pivotgrid").kendoPivotGridV2({
    height: 550,
    columnWidth: 120,
    dataSource: {
        type: "xmla",
        columns: [{ name: "[Date].[Calendar]", expand: true }, { name: "[Geography].[City]" } ],
        rows: [{ name: "[Product].[Product]" }],
        measures: ["[Measures].[Internet Sales Amount]"],
        transport: {
            connection: {
                catalog: "Adventure Works DW 2008R2",
                cube: "Adventure Works"
            },
            read: 'https://demos.telerik.com/service/v2/olap/msmdpump.dll'
        }
    }
});
var pivotgrid = $("#pivotgrid").data("kendoPivotGridV2");
pivotgrid.bind("excelExport", function(e) {
    e.workbook.fileName = "PivotGridV2.xlsx";
});
pivotgrid.saveAsExcel();
</script>
Not finding the help you need?
Contact Support