Kendo Grid Excel Export

Simple to add an excel export to the grids. Just need to added the Excel toolbar then defined the excel details on the grid.

.ToolBar(toolBar => {
        toolBar.Excel();
    })

.Excel(excel => excel
    .FileName("excelfilename.xlsx")
    .AllPages(false)
    .Filterable(true))

The data is the resultant data downloaded to the client so includes all filtering, grouping, sorting and paging.

The excel file is generated client side though a server call to the grids read action is done to get the data.

The AllPages as false (default) will show just the current page of data. Changing to true will show all the data. This will call the grids read action but with paging disabled. If the data is large then it will die. See server side excel for more information on a solution to this. Best not to use as true unless you are certain the data is small enough.

Filterable to true just enables the filtering on the excel files header. Just saves the user a few clicks in the excel file to set it up.

Note:
As with the grid if you try and pull to much data (5mb) then you will most likely get an error. The MaxJsonLength error server side if your using NewtonSoftJson. You can increase the length but then you will get the browsers failing instead. They all have a 5Mb limit.

References:
http://developer.telerik.com/featured/exporting-data-ease-using-kendo-ui-grid/


Above referring to version
Telerik Kendo UI Professional Q1 2015
Telerik UI for ASP.NET MVC Q1 2015


comments powered by Disqus