10 Answers, 1 is accepted
Basically when exporting Grid data to excel the ClientTemplate would not be used to format the data as the "Excel" file is generated on the server side. If you need to format some of the columns then you should modify the server code to export that column formatted the same way as the client template.
public ActionResult ExcelExportSave(string contentType, string base64, string fileName)
var fileContents = Convert.FromBase64String(base64);
return File(fileContents, contentType, fileName);
This is an old forum thread, in which the approach from the Excel export Code Library is discussed. Using this implementation, the user manually handles the export on the server side.
The new built in export to Excel functionality constructs the file on the client side. The server side proxy is only needed to serve the file to the user in legacy browsers
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
I'm using the method found here, http://demos.telerik.com/kendo-ui/grid/excel-export, but it's still not exporting the field as it appears after i modify it in a client template. Is it supposed to be?
I have a bound column with a client template that strings together first name and last name...
but it doesn't actually export like that.
Templates are not exported out of the box, because they may contain HTML entities that cannot be converted to HTML values. Since this does not seem to be the current case, you could use the following approach to include the template in the exported sheet.Regards,
So how can I do it?
I want to export only one column like the way it appears to me at clientTemplate?
The Kendo UI export can export text-only content to Excel. If your template results in a text string that you want to export, the approach shown in the article that Dimiter linked to should work for exporting it:
Use Column Template
You can also check this KB article, which shows what is the result of exporting various template columns:
Export to Excel Grids with Multiple Column Templates and Arbitrary Template Content
I followed this:
Use Column Template
[/quote]I followed this
My Grid is paged, it only works for the first 50.
I even replaced line 1 with:
but both have only 50 items.
It exports all data, but applies the template only for these 50 items.
How to solve this?
This behavior can be observed if your Grid uses server-side paging (the default behavior for the MVC Grid). The example takes the data items for the templates from the DataSource, but the DataSource keeps only the data needed to populate the Grid current page, not the export data. To fix this, you can use the e.data argument instead: