Grid Export To Excel with Grouping

4 posts, 0 answers
  1. Andrew
    Andrew avatar
    1 posts
    Member since:
    Jun 2013

    Posted 30 Jul 2015 Link to this post

    I am trying to export to excel using Kendo Grid with grouping enabled.  

    When the data is exported without any grouping applied, the HTML encoding / decoding works as expected and the text is displayed correctly when I open up the spreadsheet in Excel. However when I group by a column whose value contains an apostrophe (or any character needing encoding), the grouped row is exported to excel without decoding the apostrophe which the users find unpleasant.

    The grouping row is being auto-generated from Kendo MVC HTMLHelper for Grid and ​after reviewing the documentation regarding limitations around Kendo templates when exporting data to Excel.

    What is the correct way to export a grid with grouping enabled -- in particular, how does one use Kendo Export To Excel functionality with grouping row values whose text contains characters ​​that must be HTML encoded? Is this functionality possible by default, or is custom code required to address this scenario when using ASP.NET MVC?

  2. Alexander Popov
    Alexander Popov avatar
    1444 posts

    Posted 31 Jul 2015 Link to this post

    Hello Andrew,

    In this case I would suggest manually specifying the group header template, as this will generate a non-encoded string. Here is a JavaScript example illustrating the approach.

    Alexander Popov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Oli
    Oli avatar
    8 posts
    Member since:
    Oct 2015

    Posted 12 Dec 2017 Link to this post

    Is it possible to determine in the excelExport event whether the grid has been grouped?

    I am customising the columns based on index (to overcome the Use Column Template issue as described here

    It appears that the offset of the header columns with the data columns is affected once the grid has been grouped. As such, I need to amend the indexes accordingly. 

    Please can you suggest a suitable approach.

  4. Tsvetina
    Tsvetina avatar
    2481 posts

    Posted 14 Dec 2017 Link to this post

    Hi Oli,

    You can check if there are any groups in the DataSource to determine if the Grid is grouped:
    excelExport: function(e){
      if( > 0){
        // grid is grouped

    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top