We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GroupingGridToExcel freezes GUI

Thread ID:

Created:

Updated:

Platform:

Replies:

107698 Mar 12,2013 05:54 PM UTC Mar 26,2013 04:20 AM UTC WinForms 8
loading
Tags: XlsIO
Gaukhar Massabayeva
Asked On March 12, 2013 05:54 PM UTC

Here is my code:
 
 
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "Files(*.xls)|*.xls";
saveFileDialog.DefaultExt = ".xls";
if (saveFileDialog.ShowDialog() == DialogResult.OK && saveFileDialog.CheckPathExists)
{
       this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(backgroundWorker1_DoWork);
       this.backgroundWorker1.RunWorkerAsync(saveFileDialog.FileName);
}
 
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
     string fileName = (string)e.Argument;
     if (this.InvokeRequired)
     {
          this.Invoke((MethodInvoker)delegate
          {
             GroupingGridExcelConverterControl converter = new GroupingGridExcelConverterControl();
             converter.ExportStyle = false;
             converter.GroupingGridToExcel(this,
             fileName, Syncfusion.GridExcelConverter.ConverterOptions.Visible);
             converter.Dispose();
          });
     }
}
 
 
The issue I am having is, despite using a backgroundworker the GUI is freezed and doing nothing for about a minute for 1000 rows 40-60 cols.
 
In my application I intend to have up to 20000 rows in which case this sort of freeze can bring down the performance. IS there a way to fix this?
 
 

Arun Kumar V [Syncfusion]
Replied On March 18, 2013 11:50 AM UTC

Hi Gaukhar Massabayeva,

Thanks for your interest in Syncfusion products.

Query:

GroupingGrid To Excel crash

Sorry for the delay.I could not able to reproduce the issue. I have prepared a sample with ‘BackGroundWorker’ class and increasing the progress through the ‘ReportProgress()’ method which is used to raise the ‘ProgressChanged’ event. In the sample, I have invoked the ‘ReportProgress()’ within the ‘ExportElement’ event.

 

BackgroundWorker Bgworker = new BackgroundWorker();

 

//form_load

Bgworker.ProgressChanged += new ProgressChangedEventHandler(Bgworker_ProgressChanged);

Bgworker.WorkerReportsProgress = true;

 

// ProgressChanged event

void Bgworker_ProgressChanged(object sender, ProgressChangedEventArgs e)

{

this.progressBar1.Value = e.ProgressPercentage % 100;

}

 

// ExportElement event

void converter_ExportElement(object sender, GridExportElementEventArgs e)

{

if (e.Element.IsCaption() && e.Element.GroupLevel == 1 && !e.Element.ParentGroup.IsExpanded)

{

if (rowcount == 0)

rowcount = e.Element.GetRowIndex();

rowcount += e.Element.ParentGroup.Details.GetChildCount()

//below is defined for group count and add new record count.

+ this.gridGroupingControl1.TableDescriptor.GroupedColumns.Count * 2;

}

Bgworker.ReportProgress(rowcount); // set the work progress.

//other codes . . .

}

Please refer to the following sample which illustrates the same with grouping.

 

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GGCModel-2107294323.zip

Is there any possible way for you to provide us with a sample that shows this issue? or reproduce the issue in above sample. It will be easier for us to have a closer look into the problem and to resolve it.

Please let me know if you have any other concerns.

Regards,

Arun.


Gaukhar Massabayeva
Replied On March 18, 2013 02:27 PM UTC

So how long does it take before you can open a ready xsl file with the code you include above?

Gaukhar Massabayeva
Replied On March 18, 2013 02:43 PM UTC

Hi, Arun,
 
I have checked the sample you have provided.
 
The grid I am using has much more data rows and columns.
 
The length of export is still quite long and the problem I have is once export function is started User can no longer access the grid.
 
For example in the sample you provided if you try to click on anywhere in the grid (In attempts to scroll up/down) first of all the grid does not respond. Also the following exception is thrown
 
The process cannot access the file 'C:\Users\NBKIS09\Downloads\GGCModel\GGCModel\bin\Debug\Book0.xls' because it is being used by another process.
 
 
Is there any way to speed up the process. Since the work is being done is background why is the main gui thread has to be suspended?

Arun Kumar V [Syncfusion]
Replied On March 20, 2013 02:51 AM UTC

Hi Gaukhar Massabayeva,

It seems you have opened the xls file hence you might getting such problem. Please check with that. Or please let us know we will provide you the xls file. I could able to understand the requirement but could able to to get the app freeze, so please provide me the modified sample. Or else if you want the calculation speed for exporting data for large records I will modify sample but please provide me the amount of data tried to export and how many minutes it had been took to export(exact time), so that we will analyze that and get to you back with a better solution, and also please tell us the version you are using so that we will check in the reported version.

Please let me know if you have any concerns.

Regards,

Arun. 


Gaukhar Massabayeva
Replied On March 20, 2013 01:16 PM UTC

Hi Arun.
 
# of rows & cols in my application is 20000 & 50. When I use

converter.GroupingGridToExcel 

Export never finishes. Application just hangs, I am forced to restart.

 

With the sample you provided, once running, click export. While grid is exporting are you able to scroll up and down to view rows? I am not able to scroll, i.e. grid is not responding while export is in progress. In my application I need grid to respond as it normally would and have export run in the background.
 
It does not do so on my PC. The sample you provide only puts the progress report as a process executed in the background. What about the export itself? I have tried putting export process on a new thread that runs in the background to no avail, export still blocks main thread and causes GUI not to respond to any actions/scrolls/clicks.
 
 

Gaukhar Massabayeva
Replied On March 20, 2013 02:03 PM UTC

This is urgent, please reply as soon as possible.

Gaukhar Massabayeva
Replied On March 25, 2013 01:21 PM UTC

Has there been any luck investigating this issue?
 
My theory: backgroundworker tries to execute this on a background thread and the exporting process tries to access the grid, which is created on the UI thread. Is there a way to export asynchronously?

Arun Kumar V [Syncfusion]
Replied On March 26, 2013 04:20 AM UTC

Hi Gaukhar Massabayeva,

Thanks for the update.

Sorry for the delay.Please make use of the following sample and let me know if the issue is solved in your side. Please give some more information over the following line. “Is there a way to export asynchronously?”.

Regards,

Arun.



Export_bb6d2820.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;