SpreadsheetGear 2017
CalculationOnDemand Property (IWorkbookSet)






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
'Declaration
 
Property CalculationOnDemand As System.Boolean
'Usage
 
Dim instance As IWorkbookSet
Dim value As System.Boolean
 
instance.CalculationOnDemand = value
 
value = instance.CalculationOnDemand
System.bool CalculationOnDemand {get; set;}
read-write property CalculationOnDemand: System.Boolean; 
function get,set CalculationOnDemand : System.boolean
__property System.bool get_CalculationOnDemand();
__property void set_CalculationOnDemand( 
   System.bool value
);
property System.bool CalculationOnDemand {
   System.bool get();
   void set (    System.bool value);
}
Remarks

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

  1. Set IWorkbookSet.Calculation to Calculation.Manual and call IWorkbookSet.Calculate to calculate a workbook set.
  2. Set Calculation to Calculation.Automatic and set IWorkbookSet.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 a best effort attempt to calculate only the specified cell and the cells on which it depends.
  4. Mix strategy #2 or strategy #3 with calls to Calculate when it is appropriate, but note that using strategy #3 will disable multi-threaded recalc for most cells in a workbook set which will signicantly slow down calculations for some workbooks.

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.

Setting CalculationOnDemand to true will disable multi-threaded recalc for most cells in a workbook set.

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

IWorkbookSet Interface
IWorkbookSet Members
Calculation Property
BackgroundCalculation Property
Calculate Method
CalculateFull Method
CalculateFullRebuild Method