Export RadGrid (that contains RadChart) to Excel

2 posts, 0 answers
  1. EpiqDev
    EpiqDev avatar
    10 posts
    Member since:
    Aug 2012

    Posted 18 Feb 2011 Link to this post

    I have a radgrid that I would like to export to excel.
    The grid is pretty simple except that it has got a simple bar chart in it. (See the attached image file)
    Is there a way to export the grid to excel with the barchart intact?
    I've read couple of posts such as http://www.telerik.com/community/forums/aspnet-ajax/grid/exporting-chart-along-with-grid.aspx
    but it doesn't really explain in detail on how I can achieve the suggested method.
  2. Daniel
    Daniel avatar
    4949 posts

    Posted 24 Feb 2011 Link to this post

    Hello EncoreDev,

    RadGrid cannot embed images in Excel file - this is possible only when exporting to PDF. In fact, you can reference a given image in the Excel file but you have to keep in mind that the image will disappear if you remove it from the referenced location.
    protected void RadGrid1_ExcelExportCellFormatting(object sender, ExcelExportCellFormattingEventArgs e)
        if (e.FormattedColumn.UniqueName == "ChartCol")
            e.Cell.Text = "<img src='http://www.telerik.com/ClientsFiles/251162_barchart-inside-RadGrid.jpg' />";

    You have to replace the sample image with your real chart image.

    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Back to Top