Spread for ASP.NET 10 Product Documentation > Developer's Guide > Managing Formulas > Recalculating and Updating Formulas Automatically |
By default, the spreadsheet recalculates formulas in the spreadsheet when the contents of dependent cells change. You can turn this recalculation off.
Also by default, the spreadsheet updates formulas when you insert or delete columns or rows or when you move or swap blocks of cells. You can turn off these automatic formula updates. However, generally, you probably want the spreadsheet to update formulas when you insert or delete columns or rows or when you move or swap blocks of cells. Keep in mind how turning off automatic formula updating might impact the spreadsheet if the user moves data, adds rows or columns, or performs other actions that affect the location of data.
When automatic formula updating is on, the spreadsheet updates absolute and relative cell references, as follows:
For example, if you have a formula in cell C3 that references cell A1, which uses an absolute reference, and then add a row to the top of the spreadsheet, you now want the formula to reference cell A2, because cell A1 is empty. If the spreadsheet did not update the formula, your formula would be referencing different data.
For example, if you have a formula in cell C3 that references cell C1 as a relative reference, it references cell C1 as the cell that is two cells above it. If you add a row between row 2 and row 3, cell C3 is now C4, and the relative address references cell C2, the cell two cells above it. Therefore, to use the same data in the formula, the spreadsheet updates the cell reference to the cell three cells above it, C1.
Use the AutoCalculation property to turn on or off the automatic recalculation of formulas. Use the Recalculate and RecalculateAll methods for recalculating formulas.
The ClientAutoCalculation property is used for automatic calculation of client-side data. The formula updates when the cell goes out of edit mode instead of waiting until the user clicks on the save changes icon. ClientAutoCalculation will have no effect on a hierarchy. You can set either AutoCalculation or ClientAutoCalculation or both properties at the same time.
For more information about formulas, refer to the Formula Reference.
Set the AutoCalculation property and the ClientAutoCalculation property.
This example sets the AutoCalculation and ClientAutoCalculation properties.
C# |
Copy Code
|
---|---|
FpSpread1.Sheets[0].AutoCalculation = true; FpSpread1.ClientAutoCalculation = true; |
VB |
Copy Code
|
---|---|
FpSpread1.Sheets(0).AutoCalculation = True FpSpread1.ClientAutoCalculation = True |