Package io.keikai.axyra.sheets.content
Class ConditionalFormat.Builder
java.lang.Object
io.keikai.axyra.sheets.content.ConditionalFormat.Builder
- Enclosing class:
- ConditionalFormat
A fluent builder for a
ConditionalFormat. The last rule-kind call
wins; style calls accumulate.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaboveAverage(boolean below, boolean includeEqual) An above-average (or below-average whenbelow) rule.aboveAverage(boolean below, boolean includeEqual, int stdDev) An above/below-average rule restricted to a standard-deviation band: select cellsstdDevstandard deviations above (or below, whenbelow) the mean (ECMA-376 §18.3.1.1stdDev, values 1-3).Sets the data-bar axis color.axisPosition(String position) Data-bar axis position:"automatic","middle", or"none".barBorderColor(Color color) Draws a data-bar border incolor.barDirection(String direction) Data-bar direction:"context","leftToRight", or"rightToLeft".beginsWith(String text) A "cell text begins withtext" rule.AcellIsrule that matches values fromlowtohigh, both included.bold()Makes matching cells bold.border(BorderStyle style, Color color) Draw the same border style and color on all four edges of matching cells — the differential<border>of the rule style.borderSide(String side, BorderStyle borderStyle, Color color) Draw a border on one edge ("left","right","top", or"bottom") of matching cells.build()The immutable rule.AcellIsrule, for examplecellIs("greaterThan", "100").colorScale(Color... colors) A 2- or 3-color scale rule (min → [mid] → max).Highlight blank cells (Excel's "contains blanks").Highlight cells whose value is an error.containsText(String text) A "cell text containstext" rule.A data-bar rule drawn incolor.dateOccurring(TimePeriod period) A "date occurring" rule: highlight cells whose date falls in the given window (ECMA-376 §18.18.82 ST_TimePeriod).Highlight duplicate values in the range.A "cell text ends withtext" rule.expression(String formula) Anexpressionrule (a boolean formula).Fills matching cells with a solidcolor.Sets the font color of matching cells.gradient(boolean gradient) Solid (false) vs gradient (true) data-bar fill.An icon-set rule, e.g.italic()Italicize matching cells.negativeBorderColor(Color color) Sets the border color of negative-value data bars.negativeFillColor(Color color) Sets the fill color of negative-value data bars.Highlight non-blank cells.Highlight cells whose value is not an error.notContainsText(String text) A "cell text does not containtext" rule.numberFormat(String formatCode) Apply a number format code (e.g.priority(int priority) Sets the evaluation priority: 1 is evaluated first.reverse(boolean reversed) Draw the icon set in reversed order.showValue(boolean show) Show / hide the cell value beside a data bar or icon set.Stop evaluating lower-priority rules once this one matches.Strike through matching cells.top10(int rank, boolean bottom, boolean percent) A top-N (or bottom-N whenbottom) rule;percentranks by %.Single-underline matching cells.Highlight values that occur exactly once in the range.Append a threshold value object (ECMA-376 §18.3.1.11 cfvo) for a color-scale / data-bar / icon-set rule.valueObject(String type) Append a valueless threshold ("min"/"max").valueObject(String type, String value) Append a threshold with a number or formula value.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
cellIs
AcellIsrule, for examplecellIs("greaterThan", "100"). Operators:lessThan,lessThanOrEqual,equal,notEqual,greaterThanOrEqual,greaterThan,between,notBetween. An unknown operator is read asgreaterThan.formulais a formula without a leading=; text needs quotes, as in"\"Done\"". Forbetween, usebetween(String, String). -
between
AcellIsrule that matches values fromlowtohigh, both included. Both are formulas without a leading=. -
containsText
A "cell text containstext" rule. -
beginsWith
A "cell text begins withtext" rule. -
endsWith
A "cell text ends withtext" rule. -
top10
A top-N (or bottom-N whenbottom) rule;percentranks by %. -
aboveAverage
An above-average (or below-average whenbelow) rule. -
aboveAverage
An above/below-average rule restricted to a standard-deviation band: select cellsstdDevstandard deviations above (or below, whenbelow) the mean (ECMA-376 §18.3.1.1stdDev, values 1-3).includeEqualhas no effect once a band is set — it is accepted for signature symmetry. AstdDevof 0 falls back to the plain above/below-average rule. -
expression
Anexpressionrule (a boolean formula). -
duplicateValues
Highlight duplicate values in the range. -
uniqueValues
Highlight values that occur exactly once in the range. -
containsBlanks
Highlight blank cells (Excel's "contains blanks"). -
notContainsBlanks
Highlight non-blank cells. -
containsErrors
Highlight cells whose value is an error. -
notContainsErrors
Highlight cells whose value is not an error. -
notContainsText
A "cell text does not containtext" rule. The match ignores case, like Excel's SEARCH.textmust not be empty; an empty ornulltext makesRange.addConditionalFormatthrowAxyraException. -
dateOccurring
A "date occurring" rule: highlight cells whose date falls in the given window (ECMA-376 §18.18.82 ST_TimePeriod). -
colorScale
A 2- or 3-color scale rule (min → [mid] → max). Pass two or three colors; the gradient interpolates the cell values across them. Only RGB colors are accepted.- Throws:
IllegalStateException- if a color is a theme, indexed or automatic colorNullPointerException- if a color is null
-
dataBar
A data-bar rule drawn incolor. Only RGB colors are accepted.- Throws:
IllegalStateException- ifcoloris a theme, indexed or automatic colorNullPointerException- ifcoloris null
-
iconSet
An icon-set rule, e.g."3TrafficLights1","3Arrows","4Rating","5Quarters". Default thresholds split the range into equal percent bands (Excel's UI defaults); override withvalueObject(io.keikai.axyra.sheets.content.ConditionalFormat.ValueObject). -
priority
Sets the evaluation priority: 1 is evaluated first. A negative value makesRange.addConditionalFormatthrowAxyraException. -
stopIfTrue
Stop evaluating lower-priority rules once this one matches. -
valueObject
Append a threshold value object (ECMA-376 §18.3.1.11 cfvo) for a color-scale / data-bar / icon-set rule. Order matters: a data bar takes min then max; a scale or icon set takes one per color / icon. When none are supplied, Excel-matching defaults are synthesized. -
valueObject
Append a valueless threshold ("min"/"max"). -
valueObject
Append a threshold with a number or formula value. -
showValue
Show / hide the cell value beside a data bar or icon set. -
reverse
Draw the icon set in reversed order. -
gradient
Solid (false) vs gradient (true) data-bar fill. -
barBorderColor
Draws a data-bar border incolor. Only RGB colors are accepted.- Throws:
IllegalStateException- ifcoloris a theme, indexed or automatic colorNullPointerException- ifcoloris null
-
negativeFillColor
Sets the fill color of negative-value data bars. Only RGB colors are accepted.- Throws:
IllegalStateException- ifcoloris a theme, indexed or automatic colorNullPointerException- ifcoloris null
-
negativeBorderColor
Sets the border color of negative-value data bars. Only RGB colors are accepted.- Throws:
IllegalStateException- ifcoloris a theme, indexed or automatic colorNullPointerException- ifcoloris null
-
axisColor
Sets the data-bar axis color. Only RGB colors are accepted.- Throws:
IllegalStateException- ifcoloris a theme, indexed or automatic colorNullPointerException- ifcoloris null
-
axisPosition
Data-bar axis position:"automatic","middle", or"none". -
barDirection
Data-bar direction:"context","leftToRight", or"rightToLeft". -
fillColor
Fills matching cells with a solidcolor. Only RGB colors are accepted.- Throws:
IllegalStateException- ifcoloris a theme, indexed or automatic colorNullPointerException- ifcoloris null
-
fontColor
Sets the font color of matching cells. Only RGB colors are accepted.- Throws:
IllegalStateException- ifcoloris a theme, indexed or automatic colorNullPointerException- ifcoloris null
-
bold
Makes matching cells bold. -
italic
Italicize matching cells. -
strikethrough
Strike through matching cells. -
underline
Single-underline matching cells. -
numberFormat
Apply a number format code (e.g."0.00%","#,##0") to matching cells — the differential<numFmt>of the rule style. -
border
Draw the same border style and color on all four edges of matching cells — the differential<border>of the rule style. Only RGB colors are accepted; anullcolor leaves the edge color automatic.- Throws:
IllegalStateException- ifcoloris a theme, indexed or automatic colorNullPointerException- ifstyleis null
-
borderSide
Draw a border on one edge ("left","right","top", or"bottom") of matching cells. Only RGB colors are accepted; anullcolor leaves the edge color automatic.- Throws:
IllegalStateException- ifcoloris a theme, indexed or automatic colorNullPointerException- ifborderStyleis null
-
build
The immutable rule. Rule kinds and operators are checked only when the rule is added withRange.addConditionalFormat.
-