export multiple grids to one excel file

4 posts, 1 answers
  1. VLADISLAV
    VLADISLAV avatar
    32 posts
    Member since:
    Oct 2015

    Posted 15 Oct 2015 Link to this post

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

     

  2. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 15 Oct 2015 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. VLADISLAV
    VLADISLAV avatar
    32 posts
    Member since:
    Oct 2015

    Posted 15 Oct 2015 Link to this post

    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?

  5. Answer
    Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 15 Oct 2015 Link to this post

    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
Back to Top