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

export multiple grids to one excel file

3 Answers 231 Views
GridView
This is a migrated thread and some comments may be shown as answers.
VLADISLAV
Top achievements
Rank 1
VLADISLAV asked on 15 Oct 2015, 05:06 AM

I need to export data from 3 different grids into one excel file.How can i do that?

 

3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 15 Oct 2015, 08:24 AM
Hi Vladislav,

Thank you for writing.

You can use the SpreadExport functionality and export each grid in a separate sheet: 
private void radButton1_Click(object sender, EventArgs e)
{
    foreach (Control grd in this.Controls)
    {
        if (grd is RadGridView)
        {
            GridViewSpreadExport spreadExporter = new GridViewSpreadExport(((RadGridView)grd));
            SpreadExportRenderer exportRenderer = new SpreadExportRenderer();
 
            spreadExporter.SheetName = grd.Name;
            spreadExporter.FileExportMode = FileExportMode.NewSheetInExistingFile;
            spreadExporter.RunExport(@"C:\sample.xslx", exportRenderer);
        }
    }
}

Please let me know if there is something else I can help you with. 
 
Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
VLADISLAV
Top achievements
Rank 1
answered on 15 Oct 2015, 12:06 PM

oh, thanks for reply.

in exportToExcelML method im used exporter_ExcelTableCreated method fo headers on the sheet.

but for spreadexport i found only cellformatting event.So how i can edit tables and headers for sheet?

0
Accepted
Dimitar
Telerik team
answered on 15 Oct 2015, 12:55 PM
Hello Vladislav,

Thank you for writing back.

The following article shows how you can add header and footer: Add Header and Footer to the Exported Document.

Please let me know if there is something else I can help you with. 
 
Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
VLADISLAV
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
VLADISLAV
Top achievements
Rank 1
Share this question
or