Search code examples
c#asp.nettelerikexport-to-excelradgrid

Include Custom Details While Exporting Rad Grid to Excel


I am using telerik rad grid. It provides the functionality to export grid data into excel. I would like to do some modification while this data is getting exported.

I want to include company details ( i.e logo and some other custom details which are not there in rad grid ) in the exported file.

Is there any possibility of doing this with rad grid export function. Something like overriding the function where i can write these custom data to exported excel file ?

What is the best way to do this ? Please suggest.


Solution

  • Try something like this: http://www.telerik.com/forums/radgrid-export-to-excel-and-add-extra-information#pktx029dKk2yBlBGE07Msw

    The idea is to add some simple HTML in the grid before calling the export method:

    Let's copy the code from the linked thread :)

      RadGrid1.MasterTableView.Controls.Add(new LiteralControl("<span><br/>Description: Data selected using dates between 1 Jan 2011 to 1 Sep 2011</span>"));
      RadGrid1.MasterTableView.Caption = "<span><br/>Exported by: John Smith</span>";
      RadGrid1.ExportSettings.OpenInNewWindow = true;
      RadGrid1.ExportSettings.ExportOnlyData = false;
      RadGrid1.MasterTableView.ExportToExcel();