/
excelscript.calculationstate.yml
53 lines (48 loc) · 1.67 KB
/
excelscript.calculationstate.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
### YamlMime:TSEnum
name: ExcelScript.CalculationState
uid: 'ExcelScript!ExcelScript.CalculationState:enum'
package: ExcelScript!
fullName: ExcelScript.CalculationState
summary: Represents the state of calculation across the entire Excel application.
remarks: |-
#### Examples
```TypeScript
/**
* 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;
}
}
```
isPreview: false
isDeprecated: false
fields:
- name: calculating
uid: 'ExcelScript!ExcelScript.CalculationState.calculating:member'
package: ExcelScript!
summary: Calculations in progress.
- name: done
uid: 'ExcelScript!ExcelScript.CalculationState.done:member'
package: ExcelScript!
summary: Calculations complete.
- name: pending
uid: 'ExcelScript!ExcelScript.CalculationState.pending:member'
package: ExcelScript!
summary: 'Changes that trigger calculation have been made, but a recalculation has not yet been performed.'