Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,32 @@ uid: ExcelScript!ExcelScript.ConditionalDataBarNegativeFormat:interface
package: ExcelScript!
fullName: ExcelScript.ConditionalDataBarNegativeFormat
summary: Represents a conditional format for the negative side of the data bar.
remarks: ''
remarks: |-


#### Examples

```TypeScript
/**
* This script applies data bar conditional formatting to a range.
* It sets the data bar colors to be green when positive and red when negative.
*/
function main(workbook: ExcelScript.Workbook) {
// Get the "Sales" data column range in a table named "SalesTable".
const table = workbook.getTable("SalesTable");
const salesRange = table.getColumnByName("Sales").getRangeBetweenHeaderAndTotal();

// Add data bar conditional formatting to the range.
const cf = salesRange.addConditionalFormat(ExcelScript.ConditionalFormatType.dataBar);

// Have the bar show green when positive and red when negative.
const dataBarConditionalFormat = cf.getDataBar();
const positiveFormat: ExcelScript.ConditionalDataBarPositiveFormat = dataBarConditionalFormat.getPositiveFormat();
positiveFormat .setFillColor("green");
const negativeFormat: ExcelScript.ConditionalDataBarNegativeFormat = dataBarConditionalFormat.getNegativeFormat();
negativeFormat.setFillColor("red");
}
```

isPreview: false
isDeprecated: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,32 @@ uid: ExcelScript!ExcelScript.ConditionalDataBarPositiveFormat:interface
package: ExcelScript!
fullName: ExcelScript.ConditionalDataBarPositiveFormat
summary: Represents a conditional format for the positive side of the data bar.
remarks: ''
remarks: |-
#### Examples
```TypeScript
/**
* This script applies data bar conditional formatting to a range.
* It sets the data bar colors to be green when positive and red when negative.
*/
function main(workbook: ExcelScript.Workbook) {
// Get the "Sales" data column range in a table named "SalesTable".
const table = workbook.getTable("SalesTable");
const salesRange = table.getColumnByName("Sales").getRangeBetweenHeaderAndTotal();
// Add data bar conditional formatting to the range.
const cf = salesRange.addConditionalFormat(ExcelScript.ConditionalFormatType.dataBar);
// Have the bar show green when positive and red when negative.
const dataBarConditionalFormat = cf.getDataBar();
const positiveFormat: ExcelScript.ConditionalDataBarPositiveFormat = dataBarConditionalFormat.getPositiveFormat();
positiveFormat .setFillColor("green");
const negativeFormat: ExcelScript.ConditionalDataBarNegativeFormat = dataBarConditionalFormat.getNegativeFormat();
negativeFormat.setFillColor("red");
}
```
isPreview: false
isDeprecated: false
Expand Down
2 changes: 0 additions & 2 deletions docs/docs-ref-autogen/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ items:
items:
- name: API reference overview
href: overview.md
- name: Preview APIs
href: preview-apis.md
- name: ExcelScript
uid: ExcelScript!
items:
Expand Down
4 changes: 2 additions & 2 deletions generate-docs/API Coverage Report.csv
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,7 @@ ExcelScript.ConditionalDataBarDirection,N/A,Enum,Missing,false
ExcelScript.ConditionalDataBarDirection,"context",EnumField,Missing,false
ExcelScript.ConditionalDataBarDirection,"leftToRight",EnumField,Missing,false
ExcelScript.ConditionalDataBarDirection,"rightToLeft",EnumField,Missing,false
ExcelScript.ConditionalDataBarNegativeFormat,N/A,Interface,Unknown,false
ExcelScript.ConditionalDataBarNegativeFormat,N/A,Interface,Unknown,true
ExcelScript.ConditionalDataBarNegativeFormat,"getBorderColor()",Method,Excellent,false
ExcelScript.ConditionalDataBarNegativeFormat,"getFillColor()",Method,Fine,false
ExcelScript.ConditionalDataBarNegativeFormat,"getMatchPositiveBorderColor()",Method,Great,false
Expand All @@ -1171,7 +1171,7 @@ ExcelScript.ConditionalDataBarNegativeFormat,"setBorderColor(borderColor)",Metho
ExcelScript.ConditionalDataBarNegativeFormat,"setFillColor(fillColor)",Method,Fine,false
ExcelScript.ConditionalDataBarNegativeFormat,"setMatchPositiveBorderColor(matchPositiveBorderColor)",Method,Great,false
ExcelScript.ConditionalDataBarNegativeFormat,"setMatchPositiveFillColor(matchPositiveFillColor)",Method,Great,false
ExcelScript.ConditionalDataBarPositiveFormat,N/A,Interface,Unknown,false
ExcelScript.ConditionalDataBarPositiveFormat,N/A,Interface,Unknown,true
ExcelScript.ConditionalDataBarPositiveFormat,"getBorderColor()",Method,Excellent,false
ExcelScript.ConditionalDataBarPositiveFormat,"getFillColor()",Method,Fine,false
ExcelScript.ConditionalDataBarPositiveFormat,"getGradientFill()",Method,Good,false
Expand Down