Freigeben über


Excel.ConditionalTextComparisonRule interface

Stellt eine bedingte Formatregel für Zellenwerte dar.

Hinweise

[ API-Satz: ExcelApi 1.6 ]

Eigenschaften

operator

Der Operator des bedingten Textformats.

text

Der Textwert des bedingten Formats.

Details zur Eigenschaft

operator

Der Operator des bedingten Textformats.

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

Eigenschaftswert

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

Hinweise

[ API-Satz: ExcelApi 1.6 ]

text

Der Textwert des bedingten Formats.

text: string;

Eigenschaftswert

string

Hinweise

[ API-Satz: ExcelApi 1.6 ]

Beispiele

// 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("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();
});