Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
ExcelScript.ConditionalDataBarRule interface
- Package:
- ExcelScript
Represents a rule-type for a data bar.
Remarks
Used by
- ExcelScript.DataBarConditionalFormat: getLowerBoundRule, getUpperBoundRule, setLowerBoundRule, setUpperBoundRule
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);
}
Properties
| formula | The formula, if required, on which to evaluate the data bar rule. |
| type | The type of rule for the data bar. |
Property Details
formula
The formula, if required, on which to evaluate the data bar rule.
formula?: string;
Property Value
string
type
The type of rule for the data bar.
type: ConditionalFormatRuleType;
Property Value
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Office Scripts
Feedback
Was this page helpful?
