次の方法で共有


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

メソッド

getBorders()

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

getConditionalRangeBorder(index)

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

getConditionalRangeBorderBottom()

下の罫線を取得します。

getConditionalRangeBorderLeft()

左罫線を取得します。

getConditionalRangeBorderRight()

右罫線を取得します。

getConditionalRangeBorderTop()

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

getFill()

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

getFont()

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

getNumberFormat()

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

setNumberFormat(numberFormat)

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

メソッドの詳細

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