Export to excel is extremely slow

5 posts, 1 answers
  1. Anu
    Anu avatar
    8 posts
    Member since:
    May 2011

    Posted 26 Mar 2012 Link to this post

    I am trying to export using the Export to Excel via ExcelML option (code below) and it is extremely slow even to export 3000 records. Is that expected behavior or i am doing something wrong, Please help:
    I am using the RadControls for winform Q2 2011
    When i try with <200 rows it worked fast

    public void ExportToExcel()
           {
               ExportToExcelML exporter = new ExportToExcelML(this.radGV1);
               exporter.HiddenColumnOption = Telerik.WinControls.UI.Export.HiddenOption.DoNotExport;
               exporter.ExportVisualSettings = true;
               exporter.SheetMaxRows = ExcelMaxRows._1048576;
               exporter.SheetName = "sheet";
               exporter.SummariesExportOption = SummariesOption.DoNotExport;
               string fileName = "C:\\Temp\\ExportedData123.xls";
               exporter.RunExport(fileName);
           }
  2. erwin
    erwin avatar
    400 posts
    Member since:
    Dec 2006

    Posted 28 Mar 2012 Link to this post

    Anu, I suggest you update to one of the later releases of the controls.
    Alernatively you can use my no-frills export code posted here, which is quite quick but does not support any of the advanced formatting features.

    Regards
    Erwin
  3. Answer
    Ivan Petrov
    Admin
    Ivan Petrov avatar
    717 posts

    Posted 29 Mar 2012 Link to this post

    Hello Anu,

    Thank you for writing.

    The main cause for the slow performance is that you export the grid visual settings. When you have this option turned on all the grid elements have to be created in order to build the styles. After each element is created, its style is exported. If you can, I would recommend that you set styles of the cells in the ExcelCellFormatting event and turn off the export of styles settings. Also, it's always advisable to export data in a separate thread. 

    I hope this will be useful for you. Should you have further questions, I would be glad to help.

    All the best,
    Ivan Petrov
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  4. nihal
    nihal avatar
    1 posts
    Member since:
    Feb 2018

    Posted 27 Jul Link to this post

    Hello, 

    I have a similar problem. Users want to change the order of the column headers from within the application. Then they want to export to excel. I use Telerik's export method. But it's extremely slow. The codes are listed below:

    if (obj != null && obj is RadGridView)
                {
                    
                    RadGridView rGv = (RadGridView)obj;
                    string extension = "xls";
                    SaveFileDialog sfd = new SaveFileDialog()
                    {
                        DefaultExt = extension,
                        Filter = string.Format("{1} files (*.{0}|*.{0}| Tüm Dosyalar (.)|.", extension, "Excel"),
                        FilterIndex = 1,
                        FileName = fileName
                    };

                    if (sfd.ShowDialog() == true)
                    {
                        using (Stream stream = sfd.OpenFile())
                        {
                            rGv.Export(stream,
                                new GridViewExportOptions()
                                {
                                    Culture = new System.Globalization.CultureInfo("tr-TR"),
                                    Format = ExportFormat.ExcelML,
                                    ShowColumnHeaders = true,
                                    ShowColumnFooters = true,
                                 
                                });
                            Araclar.Instance.AlertMesaj("controltemplate_appbar_add_multiple", "Successful!", "Successful");
                        }
                    }

                }

     

    Thanks..

  5. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3903 posts

    Posted 27 Jul Link to this post

    Hello, Nihal, 

    I would suggest you to use one of the latest export options that RadGridView offers in order to produce the best possible output and performance:

    - GridViewSpreadExport: it utilizes our RadSpreadProcessing library to export the content of RadGridView to xlsx, csv, pdf and txt formats. This article will explain in detail the SpreadExport abilities and will demonstrate how to use it: https://docs.telerik.com/devtools/winforms/controls/gridview/exporting-data/spread-export 

    - GridViewSpreadStreamExport: it uses the RadSpreadStreamProcessing library which allows you to create big documents (without loading the entire document in the memory) and export them to the most common formats: GridViewSpreadStreamExport uses the RadSpreadStreamProcessing library which allows you to create big documents (without loading the entire document in the memory) and export them to the most common formats: https://docs.telerik.com/devtools/winforms/controls/gridview/exporting-data/spreadstream-export 

    Feel free to use this approach which suits your requirements best.

    I hope this information helps. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik

Back to Top