SpreadsheetGear The Performance Spreadsheet Component Company 
CalculationOnDemand Property
See Also 
SpreadsheetGear Namespace > IWorkbookSet Interface : CalculationOnDemand Property
Gets or sets the property which determines whether individual cells are calculated on demand. This feature is turned off by default.

Syntax

C# 
virtual bool CalculationOnDemand {get; set;}

Remarks

Calculation on demand is a feature of SpreadsheetGear for .NET which can dramatically increase performance of some applications. There are four primary strategies for calculating cells in SpreadsheetGear for .NET:

  1. Set Calculation to Calculation.Manual and call Calculate to calculate a workbook set.
  2. Set Calculation to Calculation.Automatic and set CalculationOnDemand to false (the default settings of a workbook set). With these settings, retrieving the value of a formula cell which needs to be calculated will result in the calculation of a logical group of cells all at once. This might be a column of cells, a worksheet, a workbook or the entire workbook set.
  3. Set Calculation to Calculation.Automatic and set CalculationOnDemand to true. With these settings, retrieving the value of a formula cell which needs to be calculated will result in the calculation of only the specified cell and the cells on which it depends.
  4. Mix #2 or #3 with calls to Calculate when it is appropriate.

Suppose you have a workbook where you have 100 rows and three columns. Columns A and B have a number, column C adds A + B. If you will be working within one row at a time, changing numbers in columns A and B, and retrieving the result of the formula in column C, calculation on demand will perform very well.

If, on the other hand, you will be making changes in columns A and B, and retrieving many of the cells in column C, turning off calculation on demand may perform better.

If you know that you will need all cells in a workbook set to be calculated, the most efficient strategy is to call Calculate before you start to retrieve the results of formula cells.

CalculationOnDemand has no effect if automatic calculation is not enabled by setting Calculation to Calculation.Automatic.

Requirements

Platforms: Windows Vista, Windows XP, Windows Server 2008, Windows Server 2003, Windows 2000, Windows Me and Windows 98, including 32 bit and 64 bit editions where applicable. SpreadsheetGear for .NET 1.x requires the Microsoft .NET Framework 1.1 or .NET 2.0 (works with .NET 3.x). SpreadsheetGear for .NET 2007 requires the Microsoft .NET Framework 2.0 (works with .NET 3.x).

See Also