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

RadGrid Export to Excel and add extra information

4 Answers 302 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Justin Pretorius
Top achievements
Rank 1
Justin Pretorius asked on 30 Sep 2011, 08:20 AM
Good day,

I was wondering if it is possible to include text above the exported data in an Excel file using the normal Export to Excel method with a RadGrid?

For example I wish to include a description of the data as follows,  "Description: Data selected using dates between 1 Jan 2011 to 1 Sep 2011", above the actual data exported.

I shall be grateful for any information on this matter

Justin

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 30 Sep 2011, 09:12 AM
Hello Justin,

Try the following code snippet to achieve your scenario.
C#:
protected void Btn1_Click(object sender, EventArgs e)
  {
      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();
}

Thanks,
Shinu.
0
Justin Pretorius
Top achievements
Rank 1
answered on 30 Sep 2011, 09:22 AM
Brilliant!! Thank you for the swift response!!
0
Paul
Top achievements
Rank 1
answered on 16 Dec 2014, 01:49 PM
I'm having issue with version 2013.2.717.40 with adding the same controls for the export and it not showing up at all.
0
Paul
Top achievements
Rank 1
answered on 17 Dec 2014, 09:09 PM
It's working now.
Tags
Grid
Asked by
Justin Pretorius
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Justin Pretorius
Top achievements
Rank 1
Paul
Top achievements
Rank 1
Share this question
or