[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.Workbook.DeferUpdateDirtyState

DeferUpdateDirtyState Property

DeferUpdateDirtyState

Gets or sets whether updates to the dirty states of dependent formulas affected by cell value changes are deferred.

When a cell value changes, dirty-state propagation normally runs immediately along the formula dependency chain. In scenarios with complex dependencies and frequent bulk value updates, this repeated propagation can introduce additional performance overhead.

When this property is set to true, value changes are queued and the dirty states of dependent formulas are not updated immediately. When this property is set back to false, the workbook processes the queued changes and updates the affected dirty states in a batch. Therefore, true and false must be used in pairs: each time this property is set to true, it must be set back to false after bulk updates are complete. Otherwise, features that rely on cached or delayed refresh results, such as charts, might still return stale values before the queued changes are processed.

This property is intended for bulk cell value updates and can improve performance by reducing repeated dependency analysis and dirty-state propagation. It is not recommended when Value get and set operations are interleaved.

Declaration
public bool DeferUpdateDirtyState { get; set; }
Public Property DeferUpdateDirtyState As Boolean
Implements
Examples
worksheet.Range["B1"].Formula = "=SUM(A:A)";
workbook.DeferUpdateDirtyState = true;
try
{
    for (int i = 0; i < 1000; i++)
    {
        worksheet.Range[i, 0].Value = i;
    }
}
finally
{
    workbook.DeferUpdateDirtyState = false;
}
object value = worksheet.Range["B1"].Value;