ExcelScript.CalculationMode enum
注解
示例
/**
* This script recalculates the used range of a specific worksheet.
*/
function main(workbook: ExcelScript.Workbook) {
// Only recalculate if the calculation mode is not set to automatic.
if (workbook.getApplication().getCalculationMode() !== ExcelScript.CalculationMode.automatic) {
// Get the used range from a worksheet named "Monthly Report".
const sheet = workbook.getWorksheet("Monthly Report");
const range = sheet.getUsedRange();
console.log(`Calculating ${range.getAddress()}`);
// Force all the used cells in that worksheet to calculate.
sheet.getUsedRange().calculate();
}
}
字段
automatic | 默认的重新计算行为,每次更改相关数据时,Excel 都会计算新的公式结果。 |
automaticExceptTables | 除非公式位于数据表中,否则每次更改相关数据时都会计算新的公式结果。 |
manual | 仅当用户或外接程序请求计算时才进行计算。 |