Excel.ConditionalTextComparisonRule interface

Represents a Cell Value Conditional Format Rule

[ API set: ExcelApi 1.6 ]

Properties

operator

The operator of the text conditional format.

[ API set: ExcelApi 1.6 ]

text

The Text value of conditional format.

[ API set: ExcelApi 1.6 ]

Property Details

operator

The operator of the text conditional format.

[ API set: ExcelApi 1.6 ]

operator: Excel.ConditionalTextOperator | "Invalid" | "Contains" | "NotContains" | "BeginsWith" | "EndsWith";

Property Value

Excel.ConditionalTextOperator | "Invalid" | "Contains" | "NotContains" | "BeginsWith" | "EndsWith"

text

The Text value of conditional format.

[ API set: ExcelApi 1.6 ]

text: string;

Property Value

string

Examples

await Excel.run(async (context) => {
    const sheet = context.workbook.worksheets.getItem("Sample");
    const range = sheet.getRange("B16:D18");
    const conditionalFormat = range.conditionalFormats
        .add(Excel.ConditionalFormatType.containsText);
    conditionalFormat.textComparison.format.font.color = "red";
    conditionalFormat.textComparison.rule = { operator: Excel.ConditionalTextOperator.contains, text: "Delayed" };

    await context.sync();
});