ConditionalFormat class Worksheet
A conditional formatting rule applied to a cell range.
Create one with a factory and attach it via Sheet.addConditionalFormat:
sheet.addConditionalFormat(
CellIndex.indexByString('B2'),
CellIndex.indexByString('B100'),
ConditionalFormat.greaterThan(100,
style: CellStyle(fontColorHex: ExcelColor.red)),
);
sheet.addConditionalFormat(start, end,
ConditionalFormat.colorScale(min: red, mid: yellow, max: green));
Constructors
- ConditionalFormat.between(num min, num max, {required CellStyle style})
-
Highlight cells whose value is between
minandmax(inclusive).factory - ConditionalFormat.colorScale({required ExcelColor min, ExcelColor? mid, required ExcelColor max})
-
A 2- or 3-colour scale (heat map). Pass
midfor a 3-colour scale.factory - ConditionalFormat.dataBar(ExcelColor color)
-
An in-cell data bar of the given
color.factory - ConditionalFormat.equalTo(num value, {required CellStyle style})
-
Highlight cells equal to
value.factory - ConditionalFormat.formula(String formula, {required CellStyle style})
-
Highlight cells where the boolean
formulais true, e.g.'$B1>$C1'. The formula is relative to the top-left cell of the applied range.factory - ConditionalFormat.greaterThan(num value, {required CellStyle style})
-
Highlight cells greater than
value.factory -
ConditionalFormat.iconSet(IconSetType iconSet, {bool reverse = false, bool showValue = true, List<
double> ? thresholds}) -
An icon set, a small icon (arrows, traffic lights, ratings, ...) drawn in
each cell according to where its value falls in the range.
factory
- ConditionalFormat.lessThan(num value, {required CellStyle style})
-
Highlight cells less than
value.factory
Properties
-
colors
→ List<
ExcelColor> -
The colours of a colour-scale (2 or 3) or data-bar (1) rule.
no setter
-
formulas
→ List<
String> -
The rule's formula / threshold operands (0-2 entries).
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- iconReverse → bool
-
For an icon-set rule, whether the icon order is reversed.
final
- iconSetName → String?
-
For an icon-set rule, the OOXML icon set name (e.g.
'3TrafficLights1');nullfor other rule kinds.final - iconShowValue → bool
-
For an icon-set rule, whether the cell value is shown alongside the icon.
final
-
iconThresholds
→ List<
double> -
For an icon-set rule, the threshold values (one per icon) at which each
icon takes over, as percentages by default (the first is
0).final - isThreeColor → bool
-
Whether a colour-scale rule uses three colours (has a midpoint).
no setter
- operator → String?
-
The raw OOXML comparison
operatorfor acellIsrule (e.g.'greaterThan','between'), ornullwhen the rule has none.no setter - range → String?
-
The range the rule applies to (its
sqref, e.g.'B2:B100'), ornullfor a bare rule not yet attached to a range. Populated for rules read from a file and for those added viaSheet.addConditionalFormat.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- style → CellStyle?
-
The differential style applied when a
cellIs/formularule matches;nullfor colour-scale and data-bar rules.final - type → ConditionalFormatType
-
The rule kind (a ConditionalFormatType; unmodeled kinds read as
ConditionalFormatType.other, see typeName for the raw value).
no setter
- typeName → String
-
The raw OOXML
typeof the rule (e.g.'cellIs','expression','colorScale','dataBar','iconSet','top10', ...).no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited