/
excelscript.conditionaltextoperator.yml
59 lines (53 loc) · 2 KB
/
excelscript.conditionaltextoperator.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
### YamlMime:TSEnum
name: ExcelScript.ConditionalTextOperator
uid: 'ExcelScript!ExcelScript.ConditionalTextOperator:enum'
package: ExcelScript!
fullName: ExcelScript.ConditionalTextOperator
summary: Represents the operator of the text conditional format type.
remarks: |-
#### Examples
```TypeScript
/**
* This script adds conditional formatting to the first column in the worksheet.
* This formatting gives the cells a green fill if they have text starting with "Excel".
*/
function main(workbook: ExcelScript.Workbook) {
// Get the first column in the current worksheet.
const currentSheet = workbook.getActiveWorksheet();
const firstColumn = currentSheet.getRange("A:A");
// Add conditional formatting based on the text in the cells.
const textConditionFormat =
firstColumn.addConditionalFormat(ExcelScript.ConditionalFormatType.containsText).getTextComparison();
// Set the conditional format to provide a green fill.
textConditionFormat.getFormat().getFill().setColor("green");
// Apply the condition rule that the text begins with "Excel".
const textRule: ExcelScript.ConditionalTextComparisonRule = {
operator: ExcelScript.ConditionalTextOperator.beginsWith,
text: "Excel"
};
textConditionFormat.setRule(textRule);
}
```
isPreview: false
isDeprecated: false
fields:
- name: beginsWith
uid: 'ExcelScript!ExcelScript.ConditionalTextOperator.beginsWith:member'
package: ExcelScript!
summary: ''
- name: contains
uid: 'ExcelScript!ExcelScript.ConditionalTextOperator.contains:member'
package: ExcelScript!
summary: ''
- name: endsWith
uid: 'ExcelScript!ExcelScript.ConditionalTextOperator.endsWith:member'
package: ExcelScript!
summary: ''
- name: invalid
uid: 'ExcelScript!ExcelScript.ConditionalTextOperator.invalid:member'
package: ExcelScript!
summary: ''
- name: notContains
uid: 'ExcelScript!ExcelScript.ConditionalTextOperator.notContains:member'
package: ExcelScript!
summary: ''