次の方法で共有


ExcelScript.CalculationState enum

Excel アプリケーション全体の計算の状態を表します。

注釈

/**
 * 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;
  }
}

フィールド

calculating

進行中の計算。

done

計算完了

pending

計算を引き起こす変更が行われましたが、再計算はまだ実行されていません