-
Notifications
You must be signed in to change notification settings - Fork 62
/
excel.conditionalformaticonruletype.yml
87 lines (76 loc) · 3.4 KB
/
excel.conditionalformaticonruletype.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
### YamlMime:TSEnum
name: Excel.ConditionalFormatIconRuleType
uid: 'excel!Excel.ConditionalFormatIconRuleType:enum'
package: excel!
fullName: Excel.ConditionalFormatIconRuleType
summary: Represents the types of icon conditional format.
remarks: >-
\[ [API set: ExcelApi 1.6](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/14-conditional-formatting/conditional-formatting-basic.yaml
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem("Sample");
const range = sheet.getRange("B8:E13");
const conditionalFormat = range.conditionalFormats
.add(Excel.ConditionalFormatType.iconSet);
const iconSetCF = conditionalFormat.iconSet;
iconSetCF.style = Excel.IconSet.threeTriangles;
/*
The iconSetCF.criteria array is automatically prepopulated with
criterion elements whose properties have been given default settings.
You can't write to each property of a criterion directly. Instead,
replace the whole criteria object.
With a "three*" icon set style, such as "threeTriangles", the third
element in the criteria array (criteria[2]) defines the "top" icon;
e.g., a green triangle. The second (criteria[1]) defines the "middle"
icon. The first (criteria[0]) defines the "low" icon, but it
can often be left empty as the following object shows, because every
cell that does not match the other two criteria always gets the low
icon.
*/
iconSetCF.criteria = [
{} as any,
{
type: Excel.ConditionalFormatIconRuleType.number,
operator: Excel.ConditionalIconCriterionOperator.greaterThanOrEqual,
formula: "=700"
},
{
type: Excel.ConditionalFormatIconRuleType.number,
operator: Excel.ConditionalIconCriterionOperator.greaterThanOrEqual,
formula: "=1000",
}
];
await context.sync();
});
```
isPreview: false
isDeprecated: false
fields:
- name: formula
uid: 'excel!Excel.ConditionalFormatIconRuleType.formula:member'
package: excel!
summary: '* \[ [API set: ExcelApi 1.6](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
value: '"Formula"'
- name: invalid
uid: 'excel!Excel.ConditionalFormatIconRuleType.invalid:member'
package: excel!
summary: '* \[ [API set: ExcelApi 1.6](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
value: '"Invalid"'
- name: number
uid: 'excel!Excel.ConditionalFormatIconRuleType.number:member'
package: excel!
summary: '* \[ [API set: ExcelApi 1.6](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
value: '"Number"'
- name: percent
uid: 'excel!Excel.ConditionalFormatIconRuleType.percent:member'
package: excel!
summary: '* \[ [API set: ExcelApi 1.6](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
value: '"Percent"'
- name: percentile
uid: 'excel!Excel.ConditionalFormatIconRuleType.percentile:member'
package: excel!
summary: '* \[ [API set: ExcelApi 1.6](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
value: '"Percentile"'