SpreadsheetGear 2023
MaxRecursions Property (IWorkbookSet)

SpreadsheetGear Namespace > IWorkbookSet Interface : MaxRecursions Property
Gets or sets the maximum number of recursive calculations allowed when references to cells still needing calculation are detected during workbook set calculation.
Property MaxRecursions As System.Integer
Dim instance As IWorkbookSet
Dim value As System.Integer
instance.MaxRecursions = value
value = instance.MaxRecursions
System.int MaxRecursions {get; set;}

Recursion is used when a reference to a cell still needing calculation is detected during workbook set calculation, up to the maximum number of recursions allowed by the MaxRecursions property. When the maximum number of recursions is exceeded, a slower strategy will be employed to calculate these cells.

The default number of recursions allowed is 1024. This is high enough that the vast majority of workbooks will be calculated using recursion, and low enough that stack overflow exceptions are extremely rare (this property was made public two years after SpreadsheetGear was released in response to the first reported case of a stack overflow exception).

Some workbooks will generate stack overflow exceptions in environments with limited stack size available (such as some ASP.NET implementations which are limited to a stack size of 256K). Setting MaxRecursions to a smaller number will limit the amount of stack space used.

Some complex workbooks will calculate faster with higher MaxRecursions settings.

In most cases, the setting of MaxRecursions will have little or no effect after a workbook set is calculated the first time.


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


IWorkbookSet Interface
IWorkbookSet Members