Exporting Grid to excel but including client templates? Possible?

6 posts, 0 answers
  1. License
    License avatar
    1 posts
    Member since:
    May 2013

    Posted 15 Oct 2013 Link to this post

    I found out how to export a single grid to excel from the grid but how would you export a grid that contains client templates?  Is it even possible?

    Thanks.....
  2. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 17 Oct 2013 Link to this post

    Hi,


    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.

    Kind Regards,
    Vladimir Iliev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Kannyetta
    Kannyetta avatar
    3 posts
    Member since:
    Jan 2014

    Posted 03 Feb 2015 in reply to Vladimir Iliev Link to this post

    Hi, Is there an example on the server side code? I have the below for exporting the grid but I have not been able to find any examples to get the client templates across in the export.

     [HttpPost]
        public ActionResult ExcelExportSave(string contentType, string base64, string fileName)
        {
          var fileContents = Convert.FromBase64String(base64);
          return File(fileContents, contentType, fileName);
        }

    Thanks!
  5. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2159 posts

    Posted 05 Feb 2015 Link to this post

    Hi Kannyetta,


    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

    Regards,
    Dimiter Madjarov
    Telerik
     

    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.

     
  6. Michael Warden
    Michael Warden avatar
    19 posts
    Member since:
    Jan 2004

    Posted 12 Aug 2015 in reply to Dimiter Madjarov Link to this post

    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...

     #=Lastname#, #=FirstName#

     but it doesn't actually export like that.

  7. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2159 posts

    Posted 13 Aug 2015 Link to this post

    Hello Michael,

    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,
    Dimiter Madjarov
    Telerik
    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
Back to Top
UI for ASP.NET MVC is VS 2017 Ready