Excel.ConditionalCellValueRule interface

Stellt eine Regel zur bedingten Formatierung eines Zellwerts dar.

Eigenschaften

formula1

Die Formel, falls erforderlich, für die die Regel zur bedingten Formatierung ausgewertet werden soll.

formula2

Die Formel, falls erforderlich, für die die Regel zur bedingten Formatierung ausgewertet werden soll.

operator

Der Operator des bedingten Zellwertformats.

Details zur Eigenschaft

formula1

Die Formel, falls erforderlich, für die die Regel zur bedingten Formatierung ausgewertet werden soll.

formula1: 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("B21:E23");
    const conditionalFormat = range.conditionalFormats
        .add(Excel.ConditionalFormatType.cellValue);
    conditionalFormat.cellValue.format.font.color = "red";
    conditionalFormat.cellValue.rule = { formula1: "=0", operator: "LessThan" };

    await context.sync();
});

formula2

Die Formel, falls erforderlich, für die die Regel zur bedingten Formatierung ausgewertet werden soll.

formula2?: string;

Eigenschaftswert

string

Hinweise

API-Satz: ExcelApi 1.6

operator

Der Operator des bedingten Zellwertformats.

operator: Excel.ConditionalCellValueOperator | "Invalid" | "Between" | "NotBetween" | "EqualTo" | "NotEqualTo" | "GreaterThan" | "LessThan" | "GreaterThanOrEqual" | "LessThanOrEqual";

Eigenschaftswert

Excel.ConditionalCellValueOperator | "Invalid" | "Between" | "NotBetween" | "EqualTo" | "NotEqualTo" | "GreaterThan" | "LessThan" | "GreaterThanOrEqual" | "LessThanOrEqual"

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("B21:E23");
    const conditionalFormat = range.conditionalFormats
        .add(Excel.ConditionalFormatType.cellValue);
    conditionalFormat.cellValue.format.font.color = "red";
    conditionalFormat.cellValue.rule = { formula1: "=0", operator: "LessThan" };

    await context.sync();
});