Hello, I'm exporting data from SfDataGrid to Excel. Meanwhile, the interface freezes. How can I perform background transfer without freezing the user interface? Meanwhile, I want to show the transfer percentage to the user. Is such a control possible? Also, if the number of rows is more than 1 million, I get the error RecordCount is too high.
What is the solution in case of extra rows?
Kodum
private async Task Export(bool allPageOptions, SfDataGrid sfDataGrid, string Filters)
{
VisualStateManager.GoToState(sfDataGrid, "Busy", true);
await sfDataGrid.Dispatcher.BeginInvoke(new Action(() =>
{
var options = new ExcelExportingOptions();
options.ExcelVersion = ExcelVersion.Excel2013;
options.ExportAllPages = allPageOptions;
var excelEngine = sfDataGrid.ExportToExcel(sfDataGrid.View, options);
workBook = excelEngine.Excel.Workbooks[0];
VisualStateManager.GoToState(sfDataGrid, "Normal", true);
saveFilterDialog = new SaveFileDialog
{
Filter = Filters
};
if (saveFilterDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
using (Stream stream = saveFilterDialog.OpenFile())
{
workBook.SaveAs(stream);
}
if (System.Windows.Forms.MessageBox.Show(Properties.Resources.Export_OpenQuestions, Properties.Resources.Export_Create,
MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
{
Process.Start(saveFilterDialog.FileName);
}
}
}), DispatcherPriority.Background);
}
private async void Can1ExportExcelFilter_Click(object sender, RoutedEventArgs e)
{
bool allPageOptions = Convert.ToBoolean((sender as System.Windows.Controls.MenuItem).Tag);
await Export(allPageOptions, can1DataGrid, "Excel 2007 to 2010 Files(*.xlsx)|*.xlsx|Excel 2013 File(*.xlsx)|*.xlsx");
}
Hi Özgür,
Please find the response below.
|
I'm exporting data from SfDataGrid to Excel. Meanwhile, the interface freezes. How can I perform background transfer without freezing the user interface |
While transferring large data, userinterface will be freeze. However we will check the possibilities to avoid the interface freeze and update you with more details on February 2, 2022. |
|
|
I want to show the transfer percentage to the user. Is such a control possible? |
We regret to inform that there is no possibility to achieve this requirement. please let us know if you have any concerns. |
|
|
Also, if the number of rows is more than 1 million, I get the error RecordCount is too high. |
You can resolve this by setting the version for the workbook while exporting as shown in the following code example.
Code example :
UG Reference : https://www.syncfusion.com/kb/8552/how-to-handle-maximum-number-of-extended-formats-exceeded-exception
Please revert to us with more details and code snippet you have used to export to excel, if this doesn’t resolve the problem.
|
Regards,
Sampath Narayanan.S
First of all, thank you for the replies. It would be perfect if you could provide a solution for exporting to excel without cluttering the user interface first. Because in case of high data, it can sometimes take up to 1 minute, which is quite annoying for the user.
In addition, it is necessary to somehow obtain the data transfer percentage. Informing the user at all times is very important in terms of UX, you can include such a study in your plans.
Waiting for your reply. Have a nice day.
Hi Özgür,
Please find the below response
|
It would be perfect if you could provide a solution for exporting to excel without cluttering the user interface first. Because in case of high data, it can sometimes take up to 1 minute, which is quite annoying for the user. |
As we updated previously this occurs due to exporting the large number of data to the excel. However you can resolve the freezing of UI by running the process in the background thread. There will be no other possibilities to resolve this freezing of User Interface. |
|
it is necessary to somehow obtain the data transfer percentage. Informing the user at all times is very important in terms of UX, you can include such a study in your plans. |
As we updated previously, there is no possibility to achieve this requirement. |
Regards,
Sampath Narayanan.S
As we updated previously this occurs due to exporting the large number of data to the excel. However you can resolve the freezing of UI by running the process in the background thread. There will be no other possibilities to resolve this freezing of User Interface.
Can you provide an example for this application? Even if I run it in another thread, it still freezes.
Hi Özgür,
We are checking the possibilities to achieve the requirement. We will validate and update you with more details on February 7 2022.
Regard,
Sampath Narayanan.S
Hi Özgür,
Sorry for the inconvenience
We have checked the possibilities to resolve the issue by running the process in background thread using async awaits and DispatcherPriority but still the UI freeze is not resolved. On further analysis, we have found that while exporting the huge number of record, the UI will be freeze and it is the expected one. So we regret to inform you that this issue cannot be fixed and it is expected behavior.
Regards,
Sampath Narayanan.S
Thank you for the information Sampath Narayanan.S. I will look for alternative ways.
Good work.
Hi Özgür,
Please let us know if you require any other assistance from us.
Regards,
Sampath Narayanan.S