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

Export to excel is extremely slow

4 Answers 724 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Anu
Top achievements
Rank 1
Anu asked on 26 Mar 2012, 08:00 PM
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);
       }

4 Answers, 1 is accepted

Sort by
0
erwin
Top achievements
Rank 1
Veteran
Iron
answered on 28 Mar 2012, 05:05 PM
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
0
Accepted
Ivan Petrov
Telerik team
answered on 29 Mar 2012, 11:50 AM
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 >>
0
nihal
Top achievements
Rank 1
answered on 27 Jul 2020, 11:14 AM

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..

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 27 Jul 2020, 12:16 PM

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

Tags
GridView
Asked by
Anu
Top achievements
Rank 1
Answers by
erwin
Top achievements
Rank 1
Veteran
Iron
Ivan Petrov
Telerik team
nihal
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or