This is a migrated thread and some comments may be shown as answers.

Export to excel does not include custom editor values

5 Answers 692 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ólafur Gíslason
Top achievements
Rank 1
Ólafur Gíslason asked on 22 Nov 2014, 09:28 PM
The export to excel feature in Kendo Grid does not include custom editor values similar to the category values in your example here.

http://demos.telerik.com/kendo-ui/grid/editing-custom

It only shows the header, not the values.

regards,
Olafur

5 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 25 Nov 2014, 08:53 AM
Hello,

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

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Murali
Top achievements
Rank 1
answered on 02 Nov 2016, 05:37 PM
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?
0
Murali
Top achievements
Rank 1
answered on 03 Nov 2016, 07:23 PM
Sorry Atanas, I over looked your solution, I solved it. Thanks
0
Troy
Top achievements
Rank 1
answered on 06 Nov 2016, 02:53 PM

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.

0
Dimiter Madjarov
Telerik team
answered on 08 Nov 2016, 01:57 PM

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.

Regards,
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.
 
Tags
Grid
Asked by
Ólafur Gíslason
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Murali
Top achievements
Rank 1
Troy
Top achievements
Rank 1
Dimiter Madjarov
Telerik team
Share this question
or