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

radgrid export to excel on different worksheets

3 Answers 518 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ruby
Top achievements
Rank 1
Ruby asked on 27 Jan 2014, 05:38 PM
Hi, I am trying to export 3 different radgrids to three excel worsheets (sheet1, sheet2, sheet3) within the same excel file. Could you please suggest some code on this.

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 28 Jan 2014, 04:50 AM
Hi Ruby,

Please have a look into the following code-library project demonstrates how to export data to more than one worksheet. 
Multiple worksheets in ExcelML

Thanks,
Princy
0
Ruby
Top achievements
Rank 1
answered on 28 Jan 2014, 10:33 PM
Hi Princy, I have gone through this code before which you suggested above, but not sure how to assign datatable to the new worksheet, could you please suggest some code on this. Thanks.

protected void RadGrid1_GridExporting(object source, GridExportingArgs e)
{
StringBuilder sb = new StringBuilder();
WorksheetElement workSheet = new WorksheetElement("ASP.NET Table"); //create new worksheet
workSheet.Table = ?
workSheet.Render(sb); //generate xmlss code
e.ExportOutput = e.ExportOutput.Replace("</Styles>", "</Styles>" + sb.ToString()); //add the rendered worksheet to the output
}
0
Angel Petrov
Telerik team
answered on 30 Jan 2014, 02:22 PM
Hi Ruby,

I strongly suggest that you examine this link where a possible realization of the scenario is illustrated. The code in the example is configured in such way that the user has the option to export the grids in one spreadsheet or in different ones.

Regards,
Angel Petrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Ruby
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Ruby
Top achievements
Rank 1
Angel Petrov
Telerik team
Share this question
or