Skip to content

Conditional formatting: icon thresholds with ">" (gte="0") - #1199

Closed
iluebbe wants to merge 1 commit into
storytold:mainfrom
iluebbe:fix/cf-icon-greater-than
Closed

iluebbe wants to merge 1 commit into
storytold:mainfrom
iluebbe:fix/cf-icon-greater-than

Conversation

@iluebbe

@iluebbe iluebbe commented Oct 13, 2026 •

Copy link
Copy Markdown

Fixes #1160: icon set thresholds with ">" were evaluated as ">=".

Problem

In Excel, each icon threshold is ">=" (the default) or ">". The file stores ">" as gte="0" on the threshold's cfvo. GridCraft ignored gte, so a value exactly on a ">" threshold got the next higher icon. Saving the file then dropped the gte.

Measured in Excel for Microsoft 365, 3 Traffic Lights over 0…10:

Thresholds Value Excel GridCraft before GridCraft now
Number > 3, > 6 3 red yellow red
6 yellow green yellow
Percent > 30, > 70 3 red yellow red
7 yellow green yellow

Fix

  • Model: CfRule::IconSet gets greater: Vec<bool>, one flag per threshold (same index as thresholds). It has a serde default, and an empty list means every threshold is ">=", so existing rules and saved state are unchanged.
  • XLSX:
    • the reader takes gte from each cfvo;
    • the writer writes gte="0" where a flag is set, also when the lower bound is left out and gets prepended.
  • Evaluation (cf.rs): compares with > where the flag is set.
  • Command: home.conditionalFormat takes icon thresholds, which it had no parameter for: {"type": "iconSet", "thresholds": [{"type": "num", "value": 3, "operator": ">"}, …]}. List them from the lowest up, one per icon after the first; one per icon with the lower bound first, as in the file, works too.

Testing

  • icon_thresholds_with_greater_than (engine): the table above, plus ">=" for comparison, through the command.
  • icon_set_greater_than_thresholds_roundtrip (xlsx): gte="0" is written on the right cfvo and read back.
  • full_roundtrip: its icon set now carries ">" thresholds and still compares equal.
  • Excel: a file this branch wrote with > 3 and > 6 opens with IconCriteria(2..3).Operator = xlGreater.
  • cargo xtask ci: fmt, clippy, test, assets, layers and wasm pass.
    • parity and keytips report their generated files out of date on this Windows checkout (core.autocrlf).
    • Regenerating them changes only line endings: git diff is empty, as on main.

Conflicts: #781 also adds a field to CfRule::IconSet, so whichever PR lands second needs a one-line merge.

The New Formatting Rule dialog (#1202, fixes #1165) builds on this branch, so this PR should merge first.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SAgnkqJiy3v24Hp25dQLRj

…rytold#1160)

An icon set threshold is ">=" by default or ">", stored as gte="0" on its cfvo. GridCraft
ignored gte and compared with ">=", so a value exactly on a ">" threshold got the next icon
(Excel for Microsoft 365, 3 traffic lights over 0..10 with "> 3", "> 6": 3 is red and 6
yellow; GridCraft showed yellow and green).

CfRule::IconSet keeps a per-threshold `greater` flag (serde default, empty = all ">="); the
reader takes gte, the writer writes gte="0", the evaluator compares with ">" where it is set,
and home.conditionalFormat takes icon thresholds: [{type, value, operator: ">=" | ">"}].

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SAgnkqJiy3v24Hp25dQLRj
@iluebbe

iluebbe commented Oct 15, 2026

Copy link
Copy Markdown
Author

Closing this pull request. #1160 describes the problem; its new comment adds the fix approach and Excel's read-back.

@iluebbe iluebbe closed this Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant