ExcelScript.DataBarConditionalFormat interface

表示 Excel 条件数据条类型。

注解

示例

/**
 * This script creates data bar conditional formatting on the selected range.
 * The scale of the data bar goes from 0 to 1000.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the selected range.
  const selected = workbook.getSelectedRange();
  
  // Create new conditional formatting on the range.
  const format = selected.addConditionalFormat(ExcelScript.ConditionalFormatType.dataBar);
  const dataBarFormat: ExcelScript.DataBarConditionalFormat = format.getDataBar();

  // Set the lower bound of the data bar formatting to be 0.
  const lowerBound: ExcelScript.ConditionalDataBarRule = {
    type: ExcelScript.ConditionalFormatRuleType.number,
    formula: "0"
  };
  dataBarFormat.setLowerBoundRule(lowerBound);

  // Set the upper bound of the data bar formatting to be 1000.
  const upperBound: ExcelScript.ConditionalDataBarRule = {
    type: ExcelScript.ConditionalFormatRuleType.number,
    formula: "1000"
  };
  dataBarFormat.setUpperBoundRule(upperBound);
}

方法

getAxisColor()

表示轴线颜色的 HTML 颜色代码,格式#RRGGBB (例如“FFA500”) 或命名的 HTML 颜色 (例如“橙色”) 。 如果没有轴存在或设置,则值 (空字符串) 。

getAxisFormat()

如何为 Excel 数据栏确定轴的表示形式。

getBarDirection()

指定数据条图形应基于的方向。

getLowerBoundRule()

有关构成下限 (以及如何计算下限的规则(如果适用),) 数据条。 对象 ConditionalDataBarRule 必须设置为 JSON 对象, (使用 x.lowerBoundRule = {...} 而不是 x.lowerBoundRule.formula = ...) 。

getNegativeFormat()

Excel 数据栏中轴左侧所有值的表示形式。

getPositiveFormat()

Excel 数据栏中轴右侧所有值的表示形式。

getShowDataBarOnly()

如果 true为 ,则隐藏应用数据条的单元格中的值。

getUpperBoundRule()

构成数据栏的上限(以及如何计算,如果适用)的规则。 对象 ConditionalDataBarRule 必须设置为 JSON 对象, (使用 x.upperBoundRule = {...} 而不是 x.upperBoundRule.formula = ...) 。

setAxisColor(axisColor)

表示轴线颜色的 HTML 颜色代码,格式#RRGGBB (例如“FFA500”) 或命名的 HTML 颜色 (例如“橙色”) 。 如果没有轴存在或设置,则值 (空字符串) 。

setAxisFormat(axisFormat)

如何为 Excel 数据栏确定轴的表示形式。

setBarDirection(barDirection)

指定数据条图形应基于的方向。

setLowerBoundRule(lowerBoundRule)

有关构成下限 (以及如何计算下限的规则(如果适用),) 数据条。 对象 ConditionalDataBarRule 必须设置为 JSON 对象, (使用 x.lowerBoundRule = {...} 而不是 x.lowerBoundRule.formula = ...) 。

setShowDataBarOnly(showDataBarOnly)

如果 true为 ,则隐藏应用数据条的单元格中的值。

setUpperBoundRule(upperBoundRule)

构成数据栏的上限(以及如何计算,如果适用)的规则。 对象 ConditionalDataBarRule 必须设置为 JSON 对象, (使用 x.upperBoundRule = {...} 而不是 x.upperBoundRule.formula = ...) 。

方法详细信息

getAxisColor()

表示轴线颜色的 HTML 颜色代码,格式#RRGGBB (例如“FFA500”) 或命名的 HTML 颜色 (例如“橙色”) 。 如果没有轴存在或设置,则值 (空字符串) 。

getAxisColor(): string;

返回

string

getAxisFormat()

如何为 Excel 数据栏确定轴的表示形式。

getAxisFormat(): ConditionalDataBarAxisFormat;

返回

getBarDirection()

指定数据条图形应基于的方向。

getBarDirection(): ConditionalDataBarDirection;

返回

getLowerBoundRule()

有关构成下限 (以及如何计算下限的规则(如果适用),) 数据条。 对象 ConditionalDataBarRule 必须设置为 JSON 对象, (使用 x.lowerBoundRule = {...} 而不是 x.lowerBoundRule.formula = ...) 。

getLowerBoundRule(): ConditionalDataBarRule;

返回

getNegativeFormat()

Excel 数据栏中轴左侧所有值的表示形式。

getNegativeFormat(): ConditionalDataBarNegativeFormat;

返回

getPositiveFormat()

Excel 数据栏中轴右侧所有值的表示形式。

getPositiveFormat(): ConditionalDataBarPositiveFormat;

返回

getShowDataBarOnly()

如果 true为 ,则隐藏应用数据条的单元格中的值。

getShowDataBarOnly(): boolean;

返回

boolean

getUpperBoundRule()

构成数据栏的上限(以及如何计算,如果适用)的规则。 对象 ConditionalDataBarRule 必须设置为 JSON 对象, (使用 x.upperBoundRule = {...} 而不是 x.upperBoundRule.formula = ...) 。

getUpperBoundRule(): ConditionalDataBarRule;

返回

setAxisColor(axisColor)

表示轴线颜色的 HTML 颜色代码,格式#RRGGBB (例如“FFA500”) 或命名的 HTML 颜色 (例如“橙色”) 。 如果没有轴存在或设置,则值 (空字符串) 。

setAxisColor(axisColor: string): void;

参数

axisColor

string

返回

void

setAxisFormat(axisFormat)

如何为 Excel 数据栏确定轴的表示形式。

setAxisFormat(axisFormat: ConditionalDataBarAxisFormat): void;

参数

返回

void

setBarDirection(barDirection)

指定数据条图形应基于的方向。

setBarDirection(barDirection: ConditionalDataBarDirection): void;

参数

返回

void

setLowerBoundRule(lowerBoundRule)

有关构成下限 (以及如何计算下限的规则(如果适用),) 数据条。 对象 ConditionalDataBarRule 必须设置为 JSON 对象, (使用 x.lowerBoundRule = {...} 而不是 x.lowerBoundRule.formula = ...) 。

setLowerBoundRule(lowerBoundRule: ConditionalDataBarRule): void;

参数

返回

void

setShowDataBarOnly(showDataBarOnly)

如果 true为 ,则隐藏应用数据条的单元格中的值。

setShowDataBarOnly(showDataBarOnly: boolean): void;

参数

showDataBarOnly

boolean

返回

void

setUpperBoundRule(upperBoundRule)

构成数据栏的上限(以及如何计算,如果适用)的规则。 对象 ConditionalDataBarRule 必须设置为 JSON 对象, (使用 x.upperBoundRule = {...} 而不是 x.upperBoundRule.formula = ...) 。

setUpperBoundRule(upperBoundRule: ConditionalDataBarRule): void;

参数

返回

void