次の方法で共有


ExcelScript.ConditionalTextComparisonRule interface

セル値の条件付き書式ルールを表します。

注釈

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

プロパティ

operator

テキストの条件付き書式の演算子。

text

条件付き書式のテキスト値。

プロパティの詳細

operator

テキストの条件付き書式の演算子。

operator: ConditionalTextOperator;

プロパティ値

text

条件付き書式のテキスト値。

text: string;

プロパティ値

string