Hi
We have made an "Excel Editor" based on the XtraSpreadsheet Control that populates records from a grid into a spreadsheet,
After we upgraded Devexpress from version 14.2 to 15.1 performance has decreased significantly.
Previously it took about 3-4 sec to load 3300 records. Now it takes approx 15 sec.
After a little performance measuring it seems that the "CopyFrom" that is the main time waster (see code below)
Any experience with this problem?
public void SetCellValueFromText(Cell cell, Type valueType, string value, Cell formatCell, bool readOnly)
C# {
int intValue;
double doubleValue;
--> cell.CopyFrom(formatCell, PasteSpecial.Formats);
if (valueType == typeof(System.Int32))
{
if (int.TryParse(value, out intValue))
cell.Value = intValue;
else
{
cell.Value = value;
cell.FillColor = COLOR_ERROR;
}
}
else if (valueType == typeof(System.Decimal))
{
if (double.TryParse(value, out doubleValue)) {
cell.Value = doubleValue;
cell.NumberFormat = "#,#0.00";
}
else
{
cell.Value = value;
cell.FillColor = COLOR_ERROR;
}
}
else
{
cell.Value = value;
}
cell.Protection.Locked = readOnly;
if (readOnly)
cell.Fill.BackgroundColor = COLOR_READONLY;
}
Hello Christian,
Try to disable the document history during the copy operation as shown below:
spreadsheetControl1.Document.History.IsEnabled = false; spreadsheetControl1.BeginUpdate(); // ................. // copy data from grid to spreadsheet // .................. spreadsheetControl1.EndUpdate(); spreadsheetControl1.Document.History.IsEnabled = true;
If this solution does not help you avoid the performance issue, please provide me with a sample project I can use to reproduce the problematic behavior on my side.
I will investigate it and do my best to assist you. I am looking forward to your response.
Hi Oleg
Thanks for fast response!
I have tested your suggestions. It helped a little but still still very slow. Some measurements
With version 15.1
- Original code = 23.9 sec
- With Begin / EndUpdate = 19.4 sec
- With Begin / End & History disabled = 18.5 sec
- Without the Cell.CopyFrom statement = 3.6 sec
I have made a small sample project that demonstrate the problem (enclosed)
Timedifference using the Cell.CopyFrom or not is from 0.4 sec => ~18 sec
Looking forward to see your response.