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

[Solved] Export to excel - Exporting user explicit data

1 Answer 78 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Meenakshi Nagalingam
Top achievements
Rank 1
Meenakshi Nagalingam asked on 09 Sep 2009, 04:21 PM
Hi,

While exporting rad grid data to excel, is it possible to pass user explicit data which should appear in the worksheet before the actual data exports?

Here is my actual requirement: In a search page, we'll display records based on some filter criteria. While exporting to excel, we need the search criteria information also to be exported in the worksheet.

If any one have code for this, or idea about how can we achieve, pls. share with me.

Thanks

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 09 Sep 2009, 04:56 PM
Hello Meenakshi,

You could use the GridExporting event to include additional information in the exported file.
Export to Microsoft Excel/Word/PDF/CSV

protected void RadGrid1_GridExporting(object source, GridExportingArgs e) 
    string customCode = "<table width='500px' style='padding-bottom:100px'><colgroup><col/><col/></colgroup><tr><td>test1</td><td>test2</td></tr></table>"
    e.ExportOutput = e.ExportOutput.Replace("<body>""<body>" + customCode); 


Regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Meenakshi Nagalingam
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or