Export to excel does not include custom editor values

6 posts, 0 answers
  1. Ólafur Gíslason
    Ólafur Gíslason avatar
    6 posts
    Member since:
    Mar 2007

    Posted 22 Nov 2014 Link to this post

    The export to excel feature in Kendo Grid does not include custom editor values similar to the category values in your example here.


    It only shows the header, not the values.

  2. Atanas Korchev
    Atanas Korchev avatar
    8462 posts

    Posted 25 Nov 2014 Link to this post


    Yes, by design the data from the data source is exported. If a grid column has its template set it will be ignored. Templates can be arbitrary HTML which doesn't translate to Excel. If the template isn't HTML you can manually use it as shown in this help article: http://docs.telerik.com/kendo-ui/web/grid/how-to/excel/column-template-export

    Atanas Korchev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Murali
    Murali avatar
    5 posts
    Member since:
    Jun 2016

    Posted 02 Nov 2016 in reply to Atanas Korchev Link to this post

    any solution for this? I mean I want to export the grid data which has few custom editors and the custom editors are kendo combo boxes with a template. How can I export these values with this kind of editor set up?
  4. Murali
    Murali avatar
    5 posts
    Member since:
    Jun 2016

    Posted 03 Nov 2016 in reply to Murali Link to this post

    Sorry Atanas, I over looked your solution, I solved it. Thanks
  5. Troy
    Troy avatar
    34 posts
    Member since:
    Sep 2015

    Posted 06 Nov 2016 Link to this post

    In the example, the 'excelExport' handler has to create a dummy version of the original DataSource record, containing only the 'unitPrice' field, to pass to the template as it loops through.  This would fail if the template relied on any other information in the record for the row.  

    For instance, say you ahd data something like {database_id:42, displayString: "Forty Two"}, and were displaying a column for "database_id" with the template "#=displayString#".  This works fine in the grid, where the template has the entire dataSource record available to it.  But in the Excel example, all connection with the dataSource record would be lost by the time of the "excelExport" event - the entire spreadsheet has been created?  There would be no way to get the "displayString" value to insert it into the dummy record being passed to the template handler.

    It looks like there is a way to directly export to Excel from a DataSource record, which I'm going to try for a situation similar to what I described.  But it would be nice if a column grid's template attribute could be somehow marked as safe for use in other contexts such as export formatting, or there was a separate "exportTemplate" attribute that could be set.

  6. Dimiter Madjarov
    Dimiter Madjarov avatar
    2284 posts

    Posted 08 Nov 2016 Link to this post

    Hello Troy,

    The excelExport event handler has an e.data parameter, which is essentially the array of dataItems used to create the workbook. You could use it in the described scenario to access other properties of the dataItem.

    Dimiter Madjarov
    Telerik by Progress
    Build rich, delightful, *native* Angular 2 apps with Kendo UI for Angular 2. Try it out today! Kendo UI for Angular 2 (currently in beta) is a jQuery-free toolset, written in TypeScript, designed from the ground up to offer true, native Angular 2 components.
Back to Top