The BIFF8 (.xls) conditional-formatting family supporting Excel
2007+ extension rules. TXLSWorksheet
keeps a collection of TCondFormat entries; each entry covers
one or more cell ranges and holds an ordered list of
TCondFormatRule objects, each rule being either a legacy
cell-value rule or a CF12 Data Bar / Color Scale / Icon Set rule
The four Sheet.AddCondFormat* entry points
(DataBar,
ColorScale2,
ColorScale3,
IconSet)
construct rules of the correct subtype. Available since v2.34.0
The 17 baseline Excel 2007 icon families. The numeric stop count (3, 4, or 5) is encoded in the enum name
The bar-fill color on a Data Bar rule and the per-stop colors
on a Color Scale rule can be set against a workbook theme index
plus a tint value via SetThemeColor(ThemeId, Tint)
instead of a frozen RGB. The XLSX writer emits
<color theme="N"/> when Tint is
exactly 0.0 or <color theme="N" tint="0.5"/>
when non-zero, matching Excel's own "shortest form" output. The
reader parses both attribute combinations and falls back to the
RGB rgb= path when neither theme nor
tint is present. Two modes are mutually exclusive
per slot; whichever Set was called last wins
IsThemeColor reflects the active mode for
inspection
BIFF8 CF12 stores the resolved RGB color only — theme mode
round-trips on the XLSX backend exclusively in this release
iconSet rules have no <color>
elements so the theme-mode addition does not affect them
Each stop in an Icon Set rule can override its display icon
with any icon from any of the 17 built-in icon families,
identified by an (OverrideSet, IconId) pair. XLSX emits
<cfIcon iconSet="..." iconId="N"/> per
overridden stop. BIFF8 CF12 continues to render the
family-default icon because the BIFF8 wire format has no slot
for per-stop override — this is an XLSX-only capability in
the current release. HasIconOverride[i] returns
True only for stops that have been explicitly opted in via
SetIconOverride; the default-icon stops continue to
use the family's stop-position default
Exactly one of DataBar / ColorScale /
IconSet is non-nil per CF12 rule, matching the rule's
Kind. Legacy cellIs rules (non-CF12) leave all three nil
and use Operator_ + Formula1 / Formula2
The Style property (v2.35.0+) is lazy-created on first
read; the returned object is owned by the rule and freed in its
destructor. Set HasXxx via the corresponding
SetXxx call on Style. The BIFF8 reader
keeps the raw bytes in DxfBlob in addition to decoding
them into Style (v2.35.1+), so a load-edit-save round-trip
reflects any post-load mutation of Style; if the user
doesn't touch it, the saved file carries the same overrides as the
original
On BIFF8 CF12 Data Bar, Color Scale, and Icon Set rules,
[MS-XLS] requires the inline DXF block to be empty. Starting with
v2.87.4, HotXLS follows that rule: style overrides assigned through
Rule.Style are not serialized for those three CF12 kinds
when saving .xls files. The Data Bar / Color Scale / Icon Set rule
configuration itself is still preserved through the CF12 kind-specific
tail. XLSX conditional-formatting output is unaffected
Excel-saved files often carry both an Excel 2003 cell-value
CONDFMT and an Excel 2007+ CONDFMT12
covering the same sqref — the cell-value record is a
cross-version fallback the older Excel can still render. The
reader flags the older entry via IsShadowed = True
after detecting an exact bounding-box match on
TotalRange, so user-facing code that iterates the
conditional-format collection can skip the duplicate. The writer
continues to emit both record families on save for Excel 2003
↔ Excel 2007+ compatibility
On BIFF8 SaveAs(xlExcel97), CF12 rules emit
CONDFMT12 ($0879) + CF12 ($087A)
records alongside the legacy CONDFMT ($01B0) +
CF ($01B1) for cross-version compatibility with Excel
2003. The reader recognizes the modern records and exposes them through
the same in-memory rule model so Excel-authored .xls files with
extension rules round-trip without data loss
TXLSWorksheet.AddCondFormatDataBar
TXLSWorksheet.AddCondFormatColorScale2
TXLSWorksheet.AddCondFormatColorScale3
TXLSWorksheet.AddCondFormatIconSet
TXLSXConditionalFormat (XLSX side)