Partager via


ExcelScript.CalculationState enum

Représente l’état du calcul dans l’ensemble de l’application Excel.

Remarques

Exemples

/**
 * This script uses the fill color of the first cell to indicate the current
 * calculation state of the workbook.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the first cell in the first worksheet.
  const cell = workbook.getWorksheets()[0].getCell(0,0);

  // Get that cell's fill object.
  const cellFill = cell.getFormat().getFill();

  // Set the cell fill based on the calculation state.
  const calcState = workbook.getApplication().getCalculationState();
  switch (calcState) {
    case ExcelScript.CalculationState.pending:
      cellFill.setColor("Red");
      break;
    case ExcelScript.CalculationState.calculating:
      cellFill.setColor("Yellow");
      break;
    case ExcelScript.CalculationState.done:
      cellFill.setColor("Green");
      break;
  }
}

Champs

calculating

Calculs en cours.

done

Calculs terminés.

pending

Des modifications déclenchant un calcul ont eu lieu, mais le recalcul n'a pas encore été effectué.