Search Results for

    Show / Hide Table of Contents

    ExcelFile.StartBatchRecalcCells Method

    This method tells FlexCel that you are going to call multiple times RecalcCell without changing any data in the spreadsheet. This way, FlexCel won't keep recalculating the same supporting cells each time you call RecalcCells.

    Always match this call with a call to EndBatchRecalcCells.

    Syntax

    Namespace: FlexCel.Core

    public abstract void StartBatchRecalcCells()

    Examples

    Let's imagine that you want to read the values of cell A1 and cell A2 in a spreadsheet. Let's also imagine that both A1 and A2 depend on cell B1 and B1 depends in a lot of other cells. If you call RecalcCell first in A1 and then in A2, FlexCel will recalculate B1 and all the cells B1 depends on twice. But if you wrap both calls in Start/EndBatchRecalcCells:

        //Tell FlexCel that from here, all calls to RecalcCell can use the values calculated by previous calls
        //to RecalcCells.
        xls.StartBatchRecalcCells();
    
        object A1Value = xls.RecalcCell(1, 1, 1, true);
    
        //This will not recalculate again anything the previous call calculated.
        object A2Value = xls.RecalcCell(2, 1, 1, true);
    
        //Go back to normal mode.
        xls.EndBatchRecalcCells();
    

    Then FlexCel will calculate B1 only when calculating A1, and will not calculate it again when calculating A2.

    See also

    • ExcelFile
    In This Article
    Back to top FlexCel Studio for the .NET Framework v7.24.0.0
    © 2002 - 2025 tmssoftware.com