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

Export RadGrid (that contains RadChart) to Excel

1 Answer 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
EpiqDev
Top achievements
Rank 2
EpiqDev asked on 18 Feb 2011, 11:43 PM
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.

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 24 Feb 2011, 10:22 AM
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.

Regards,
Daniel
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!
Tags
Grid
Asked by
EpiqDev
Top achievements
Rank 2
Answers by
Daniel
Telerik team
Share this question
or