You can not avoid calling the RunExport method on each iteration when exporting multiple grids. If you want to achieve a better performance, I would suggest you using the GridViewSpreadStreamExport in this case. The GridViewSpreadStreamExport uses the RadSpreadStreamProcessing library which allows you to create big documents (without loading the entire document in the memory) and export them.
Spread streaming is a document processing paradigm that allows you to create big spreadsheet documents with great performance and minimal memory footprint. The key for the memory efficiency is that the spread streaming library writes the spreadsheet content directly to a stream without creating and preserving the spreadsheet document model in memory. Each time an exporter object is disposed, the set values are written into the stream. RadSpreadStreamProcessing library to create and export a large amount of data with a low memory footprint which I believe would be suitable if you export multiple grids.
It offers FileExportMode property. You can set it so that you export multiple grids in a single file each being on a separate sheet:
private void radButton1_Click(object sender, EventArgs e)
foreach (Control grd in this.Controls)
if (grd is RadGridView)
GridViewSpreadStreamExport spreadStreamExport = new GridViewSpreadStreamExport(grd as RadGridView);
spreadStreamExport.ExportVisualSettings = true;
spreadStreamExport.FileExportMode = FileExportMode.NewSheetInExistingFile;
SpreadStreamExportRenderer exportRenderer = new SpreadStreamExportRenderer();
An alternative approach is to create a workbook on your own, iterate all the grids and populate the workbook with the data from the grids programmatically. Once all grids are traversed and the workbook is filled with data, you can export it to an Excel file. The following blogs are quite useful on this topic:
I hope this information is useful. If you have other questions please let me know.
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.