ExcelScript.TextConditionalFormat 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: ExcelScript.TextConditionalFormat = 
    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);
}

メソッド

getFormat()

条件付き書式のフォント、塗りつぶし、罫線、およびその他のプロパティをカプセル化する format オブジェクトを返します。

getRule()

条件付き書式のルール。

setRule(rule)

条件付き書式のルール。

メソッドの詳細

getFormat()

条件付き書式のフォント、塗りつぶし、罫線、およびその他のプロパティをカプセル化する format オブジェクトを返します。

getFormat(): ConditionalRangeFormat;

戻り値

getRule()

条件付き書式のルール。

getRule(): ConditionalTextComparisonRule;

戻り値

setRule(rule)

条件付き書式のルール。

setRule(rule: ConditionalTextComparisonRule): void;

パラメーター

戻り値

void