次の方法で共有


Excel.ConditionalColorScaleCriterion interface

型、値、および色を含む色スケール条件を表します。

注釈

[ API セット: ExcelApi 1.6 ]

// 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("B2:M5");
    const conditionalFormat = range.conditionalFormats
        .add(Excel.ConditionalFormatType.colorScale);
    const criteria = {
        minimum: { formula: null, type: Excel.ConditionalFormatColorCriterionType.lowestValue, color: "blue" },
        midpoint: { formula: "50", type: Excel.ConditionalFormatColorCriterionType.percent, color: "yellow" },
        maximum: { formula: null, type: Excel.ConditionalFormatColorCriterionType.highestValue, color: "red" }
    };
    conditionalFormat.colorScale.criteria = criteria;

    await context.sync();
});

プロパティ

color

カラー スケールの色の HTML カラー コード表現 (たとえば、#FF0000 は赤を表します)。

formula

数値、数式、または null ( typelowestValueされている場合)。

type

条件条件式の基になる必要がある内容。

プロパティの詳細

color

カラー スケールの色の HTML カラー コード表現 (たとえば、#FF0000 は赤を表します)。

color?: string;

プロパティ値

string

注釈

[ API セット: ExcelApi 1.6 ]

formula

数値、数式、または null ( typelowestValueされている場合)。

formula?: string;

プロパティ値

string

注釈

[ API セット: ExcelApi 1.6 ]

type

条件条件式の基になる必要がある内容。

type: Excel.ConditionalFormatColorCriterionType | "Invalid" | "LowestValue" | "HighestValue" | "Number" | "Percent" | "Formula" | "Percentile";

プロパティ値

Excel.ConditionalFormatColorCriterionType | "Invalid" | "LowestValue" | "HighestValue" | "Number" | "Percent" | "Formula" | "Percentile"

注釈

[ API セット: ExcelApi 1.6 ]