We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Setting ComboBox selectedindex

I have a situation where I programitically populate 2 columns with maybe 100 rows. A lot of the cells have comboboxes.

When I initially populate the cells, setting each selectedindex for the combobox takes about .01 seconds.

However, when the user changes a value in the combo, I'm re-populating that cell's column so I can rebuild the styles based on the change.

During this re-population of the column, the setting of the selectedindex now takes about .4 seconds.

Can you think of any reason why it would take longer for the selectedindex to be set the 2nd time around?

I do have a couple of selecteddatachanged events, but those events aren't firing after stepping through the code which is by design.

After further debugging, it's related to having formulas in some of the cells.

By not setting any formulas "=SUM(B43:C43)", it ran as fast as the original load time.

Seems like it's similar to SetCellValue being faster than setting the Value property on the cell...can something be done for setting the selectedindex?


Thank you for reporting this issue.

I think you are right. It's related to setting Cell’s value with Cell.Value when the combobox’s selected index is changed. We will figure out this issue and get back to you soon.


Please try the attached version.

Please use the new added method Combobox.SetSelectedIndex() to set the selected index. This method will not call calculate formulas. To calculate formula, you need to call GridDesktop.RunAllFormulas manually.

Thank you.

Thank you! Yes, this did fix it.

If you can think of any other areas where the formulas might be recalculating when I wouldn't want them to, that would be great.

It would be nice to only have them recalcuate when I call RunAllFormulas.

Maybe that could be a property.

RecalculateFormulas = false;

Do some work

RecalculateFormulas = true;



<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for providing us this idea. We will look into this feature in future versions and get back to you.


Please try the attached version.

We added the new property “GridDesktop.RecalculateFormulas”. It indicates whether to recalculate all the cells's formula when a cell's value changed. The default value is true.

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Setting Cell.Value and Combobox.SelectedIndex properties will auto recalculate formulas if GridDesktop.RecalculateFormulas is ture. If GridDesktop.RecalculateFormulas is false, they will not auto recalculate formulas.

Cell.SetValue() and Combobox.SetSelectedIndex() will still not recalculate formulas in any case even GridDesktop.RecalculateFormulas is true.

Thank you.