ExcelScript.ConditionalRangeFormat interface

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

注釈

使用元

/**
 * This script applies cell value conditional formatting to a range.
 * Any value less than 60 will have the cell's fill color changed and the font made italic.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the range to format.
  const selectedRange = workbook.getSelectedRange();

  // Add cell value conditional formatting.
  const cellValueConditionalFormatting =
    selectedRange.addConditionalFormat(ExcelScript.ConditionalFormatType.cellValue).getCellValue();

  // Create the condition, in this case when the cell value is less than 60.
  const rule: ExcelScript.ConditionalCellValueRule = {
    formula1: "60",
    operator: ExcelScript.ConditionalCellValueOperator.lessThan
  };
  cellValueConditionalFormatting.setRule(rule);

  // Set the format to apply when the condition is met.
  const format: ExcelScript.ConditionalRangeFormat = cellValueConditionalFormatting.getFormat();
  format.getFill().setColor("yellow");
  format.getFont().setItalic(true);
}

メソッド

clearFormat()

条件付き書式ルールから書式プロパティを削除します。 これにより、書式設定のないルールが作成されます。

getBorders()

条件付き書式の範囲全体に適用される罫線オブジェクトのコレクション。

getConditionalRangeBorder(index)

オブジェクトの名前を使用して、境界線オブジェクトを取得します。

getConditionalRangeBorderBottom()

下の罫線を取得します。

getConditionalRangeBorderLeft()

左罫線を取得します。

getConditionalRangeBorderRight()

右罫線を取得します。

getConditionalRangeBorderTop()

上部の罫線を取得します。

getFill()

条件付き書式の範囲全体で定義されている塗りつぶしオブジェクトを返します。

getFont()

条件付き書式範囲全体で定義されているフォント オブジェクトを返します。

getNumberFormat()

指定した範囲の Excel の数値書式コードを表します。 nullが渡された場合はクリアされます。

setNumberFormat(numberFormat)

指定した範囲の Excel の数値書式コードを表します。 nullが渡された場合はクリアされます。

メソッドの詳細

clearFormat()

条件付き書式ルールから書式プロパティを削除します。 これにより、書式設定のないルールが作成されます。

clearFormat(): void;

返品

void

getBorders()

条件付き書式の範囲全体に適用される罫線オブジェクトのコレクション。

getBorders(): ConditionalRangeBorder[];

返品

getConditionalRangeBorder(index)

オブジェクトの名前を使用して、境界線オブジェクトを取得します。

getConditionalRangeBorder(
            index: ConditionalRangeBorderIndex
        ): ConditionalRangeBorder;

パラメーター

index
ExcelScript.ConditionalRangeBorderIndex

取得する border オブジェクトのインデックス値。 詳細は「ExcelScript.ConditionalRangeBorderIndex」をご覧ください。

返品

getConditionalRangeBorderBottom()

下の罫線を取得します。

getConditionalRangeBorderBottom(): ConditionalRangeBorder;

返品

getConditionalRangeBorderLeft()

左罫線を取得します。

getConditionalRangeBorderLeft(): ConditionalRangeBorder;

返品

getConditionalRangeBorderRight()

右罫線を取得します。

getConditionalRangeBorderRight(): ConditionalRangeBorder;

返品

getConditionalRangeBorderTop()

上部の罫線を取得します。

getConditionalRangeBorderTop(): ConditionalRangeBorder;

返品

getFill()

条件付き書式の範囲全体で定義されている塗りつぶしオブジェクトを返します。

getFill(): ConditionalRangeFill;

返品

getFont()

条件付き書式範囲全体で定義されているフォント オブジェクトを返します。

getFont(): ConditionalRangeFont;

返品

getNumberFormat()

指定した範囲の Excel の数値書式コードを表します。 nullが渡された場合はクリアされます。

getNumberFormat(): string;

返品

string

setNumberFormat(numberFormat)

指定した範囲の Excel の数値書式コードを表します。 nullが渡された場合はクリアされます。

setNumberFormat(numberFormat: string): void;

パラメーター

numberFormat

string

返品

void