Search Results for

    Show / Hide Table of Contents

    TExcelFile.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

    Unit: FlexCel.Core

    procedure TExcelFile.StartBatchRecalcCells; virtual; abstract;

    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:

    var
      A1Value: TCellValue;
      A2Value: TCellValue;
    ...
       //Tell FlexCel that from here, all calls to RecalcCell can use the values calculated by previous calls
       //to RecalcCells.
      xls.StartBatchRecalcCells;
      A1Value := xls.RecalcCell(1, 1, 1, true);
      A2Value := xls.RecalcCell(2, 1, 1, true);  //This will not recalculate again anything the previous call calculated.
       //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

    • TExcelFile
    In This Article
    Back to top FlexCel Studio for VCL and FireMonkey v7.24
    © 2002 - 2025 tmssoftware.com