Skip to content

xlsx: read conditional formats kept only in the x14 extension list - #6

Closed
pick2510 wants to merge 3 commits into
mainfrom
fix/x14-conditional-formats
Closed

pick2510 wants to merge 3 commits into
mainfrom
fix/x14-conditional-formats

Conversation

@pick2510

Copy link
Copy Markdown
Owner

Summary

Excel 2010+ writes a conditional format into the extension list alone when the rule's formula refers to another sheet: x14:conditionalFormatting, with formulas in xm:f and the format inline in x14:dxf. Some exporters write every rule that way. GridCraft read that list only for data-bar extensions and dropped these rules. In three grade sheets from a private corpus (not committed), the pink "repeat student" highlighting over a whole block of rows was missing.

  • cf_rule(): the cfRule type match is now shared between <conditionalFormatting> and the x14 list.
  • styles::read_dxf(): dxf parsing is shared, and also reads an inline x14:dxf.
  • A standalone x14 rule (any formula or text type; data bars and icon sets still go through the existing extension path) is read with its xm:sqref ranges, priority and stop-if-true. It is saved as an ordinary conditional format. A rule without a range is skipped with the existing warning.

Tests (built in code)

crates/xlsx/src/tests/x14_cond_formats.rs:

  • x14_only_rules_are_read: a cell-value rule (operator, formula, font and fill colours, priority) and an expression rule over two ranges are read, and a rule without a range is dropped.
  • x14_only_rules_survive_saving: the same checks after write_xlsx and a re-read.

Both fail on main, where no rules are read.

CI

cargo xtask ci: fmt, clippy, assets, layers, wasm, parity and keytips pass, and every test passes except the pre-existing header_autofit::table_filter_autofit_works_through_command_and_header_double_click. That test fails identically on main on this machine with Carlito installed (see #1).

🤖 Generated with Claude Code

bflatastic and others added 3 commits October 22, 2026 17:57
Excel 2010+ writes a conditional format into the extension list alone
(x14:conditionalFormatting, formulas in xm:f, the format inline in
x14:dxf) when its formula refers to another sheet, and some exporters
write every rule that way. GridCraft read that list only for data-bar
extensions and dropped these rules, so such sheets lost their
highlighting.

The cfRule parsing is shared (cf_rule), the dxf parsing too (read_dxf);
a standalone x14 rule is read with its xm:sqref ranges and saved as an
ordinary conditional format.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pick2510
pick2510 force-pushed the fix/x14-conditional-formats branch from f3dca9b to 1392304 Compare October 22, 2026 13:00
@pick2510

Copy link
Copy Markdown
Owner Author

Superseded by storytold#2262 (same branch, opened upstream).

@pick2510 pick2510 closed this Oct 22, 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

Development

Successfully merging this pull request may close these issues.

2 participants