Improve export to Excel.



I need to export the contents of a datagrid, but I have noticed that it is very slow even when the rows are less than 100.


I have two questions:

-How could I improve my code?

the slow part is only in red:

Image_8633_1717708864835



-How could I display a progress bar correctly if there is no support for that?

this is fake loop:

Image_8761_1717708891512


3 Replies

SP Sreemon Premkumar Muthukrishnan Syncfusion Team June 7, 2024 06:11 PM UTC

Hi Sergio Ayala,

We have checked the reported issue regarding the delay in executing the ExcelToExport method. we have checked by exporting the SfDataGrid to excel with 100 rows, but it takes less then 1 second. We have attached the tested sample with the video representation. Could you please provide the following information,

  1. Could you please provide more information regarding the SfDataGrid customization?
  2. Could you please provide detail of how much time taken to execute the ExportToExcel method in you project?
  3. If possible, could you please modify our sample to replicate the issue?

This will be helpful for us to replicate the issue and validate it further.

Regarding the progress bar, we are little bit unclear about your requirement. Could you please more information regarding your requirement about which progress you need to show in the progress bar?

Regards,

Sreemon Premkumar M.


Attachment: SfDataGrid_excelExporting_bc51ed88.zip


SA Sergio Ayala June 10, 2024 07:35 PM UTC

I have to export around 5000 records, I think the problem is that my columns are many and of different types and multiple formats:


This is my user control base (view base)

Image_2027_1718047853228

This is the some view:

Image_4250_1718047922023

and this is my events exporting:

Image_5695_1718048014049


About the progress bar: my intention is to show the loop of those 5000 rows... it occurred to me to make a fake loop, but it is neither optimal nor real.



SP Sreemon Premkumar Muthukrishnan Syncfusion Team June 11, 2024 07:58 PM UTC

Hi Sergio Ayala,

We have checked the code snippet you shared and implemented it in a simple sample. We added 32 columns with different types. We observed that when exporting to Excel, the generation of the Excel file takes approximately 17 seconds for 5000 rows and approximately 4 seconds for 100 rows. Could you please confirm whether this is the delay you are currently experiencing with your project during exporting? Also, could you please provide how much time does it take to complete the export in your sample with 5000 and 100 rows?

If we have misunderstood your requirement, could you please provide a video reference to demonstrate the delay you are facing with your project

This information will help us to validate the issue further.

Regarding the progress bar, we have shown the loop of 5000 rows in the progress bar. Please find the code snippet below.

If we have misunderstood your requirement, could you please provide more information regarding your needs with the progress bar?

We have attached the tested sample with the video reference for the delay issue and the progress bar, please find it in the attachment.

Regards,

Sreemon Premkumar M.


Attachment: SfDataGrid_excelExporting_69ace7b.zip

Loader.
Up arrow icon