ExcelScript.DataBarConditionalFormat interface
Represents an Excel conditional data bar type.
Remarks
Examples
/**
* 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);
}
Methods
get |
HTML color code representing the color of the Axis line, in the form #RRGGBB (e.g., "FFA500") or as a named HTML color (e.g., "orange"). Value is "" (an empty string) if no axis is present or set. |
get |
Representation of how the axis is determined for an Excel data bar. |
get |
Specifies the direction that the data bar graphic should be based on. |
get |
The rule for what constitutes the lower bound (and how to calculate it, if applicable) for a data bar. The |
get |
Representation of all values to the left of the axis in an Excel data bar. |
get |
Representation of all values to the right of the axis in an Excel data bar. |
get |
If |
get |
The rule for what constitutes the upper bound (and how to calculate it, if applicable) for a data bar. The |
set |
HTML color code representing the color of the Axis line, in the form #RRGGBB (e.g., "FFA500") or as a named HTML color (e.g., "orange"). Value is "" (an empty string) if no axis is present or set. |
set |
Representation of how the axis is determined for an Excel data bar. |
set |
Specifies the direction that the data bar graphic should be based on. |
set |
The rule for what constitutes the lower bound (and how to calculate it, if applicable) for a data bar. The |
set |
If |
set |
The rule for what constitutes the upper bound (and how to calculate it, if applicable) for a data bar. The |
Method Details
getAxisColor()
HTML color code representing the color of the Axis line, in the form #RRGGBB (e.g., "FFA500") or as a named HTML color (e.g., "orange"). Value is "" (an empty string) if no axis is present or set.
getAxisColor(): string;
Returns
string
getAxisFormat()
Representation of how the axis is determined for an Excel data bar.
getAxisFormat(): ConditionalDataBarAxisFormat;
Returns
getBarDirection()
Specifies the direction that the data bar graphic should be based on.
getBarDirection(): ConditionalDataBarDirection;
Returns
getLowerBoundRule()
The rule for what constitutes the lower bound (and how to calculate it, if applicable) for a data bar. The ConditionalDataBarRule
object must be set as a JSON object (use x.lowerBoundRule = {...}
instead of x.lowerBoundRule.formula = ...
).
getLowerBoundRule(): ConditionalDataBarRule;
Returns
getNegativeFormat()
Representation of all values to the left of the axis in an Excel data bar.
getNegativeFormat(): ConditionalDataBarNegativeFormat;
Returns
getPositiveFormat()
Representation of all values to the right of the axis in an Excel data bar.
getPositiveFormat(): ConditionalDataBarPositiveFormat;
Returns
getShowDataBarOnly()
If true
, hides the values from the cells where the data bar is applied.
getShowDataBarOnly(): boolean;
Returns
boolean
getUpperBoundRule()
The rule for what constitutes the upper bound (and how to calculate it, if applicable) for a data bar. The ConditionalDataBarRule
object must be set as a JSON object (use x.upperBoundRule = {...}
instead of x.upperBoundRule.formula = ...
).
getUpperBoundRule(): ConditionalDataBarRule;
Returns
setAxisColor(axisColor)
HTML color code representing the color of the Axis line, in the form #RRGGBB (e.g., "FFA500") or as a named HTML color (e.g., "orange"). Value is "" (an empty string) if no axis is present or set.
setAxisColor(axisColor: string): void;
Parameters
- axisColor
-
string
Returns
void
setAxisFormat(axisFormat)
Representation of how the axis is determined for an Excel data bar.
setAxisFormat(axisFormat: ConditionalDataBarAxisFormat): void;
Parameters
- axisFormat
- ExcelScript.ConditionalDataBarAxisFormat
Returns
void
setBarDirection(barDirection)
Specifies the direction that the data bar graphic should be based on.
setBarDirection(barDirection: ConditionalDataBarDirection): void;
Parameters
- barDirection
- ExcelScript.ConditionalDataBarDirection
Returns
void
setLowerBoundRule(lowerBoundRule)
The rule for what constitutes the lower bound (and how to calculate it, if applicable) for a data bar. The ConditionalDataBarRule
object must be set as a JSON object (use x.lowerBoundRule = {...}
instead of x.lowerBoundRule.formula = ...
).
setLowerBoundRule(lowerBoundRule: ConditionalDataBarRule): void;
Parameters
- lowerBoundRule
- ExcelScript.ConditionalDataBarRule
Returns
void
setShowDataBarOnly(showDataBarOnly)
If true
, hides the values from the cells where the data bar is applied.
setShowDataBarOnly(showDataBarOnly: boolean): void;
Parameters
- showDataBarOnly
-
boolean
Returns
void
setUpperBoundRule(upperBoundRule)
The rule for what constitutes the upper bound (and how to calculate it, if applicable) for a data bar. The ConditionalDataBarRule
object must be set as a JSON object (use x.upperBoundRule = {...}
instead of x.upperBoundRule.formula = ...
).
setUpperBoundRule(upperBoundRule: ConditionalDataBarRule): void;
Parameters
- upperBoundRule
- ExcelScript.ConditionalDataBarRule
Returns
void
Office Scripts