Skip to content

fix(xlsx): honor data bar rule color written as start/end tags#397

Merged
developer0hye merged 1 commit into
mainfrom
fix/xlsx-databar-color
Jul 21, 2026
Merged

fix(xlsx): honor data bar rule color written as start/end tags#397
developer0hye merged 1 commit into
mainfrom
fix/xlsx-databar-color

Conversation

@developer0hye

Copy link
Copy Markdown
Owner

Summary

Data bars ignored the conditional-formatting rule's <color rgb> and always rendered the parser's default steel blue when the rule's children were written as start/end pairs (<color rgb="FF1E2761"></color>, the form produced by openpyxl among others). umya-spreadsheet's DataBar reader only matched Event::Empty, so both the cfvo and color collections came back empty and apply_data_bar_rule fell back to #638EC6 (issue #371).

The reader fix lands in the umya-spreadsheet fork this workspace patches to (branch fix/panic-safety-v2), mirroring ColorScale's reader which already handles both event kinds. It is also upstreamed as MathNya/umya-spreadsheet#347. This PR pins the behavior on the office2pdf side with a regression test that rewrites fixture XML into the start/end-tag form before parsing.

Measured on the sales-dashboard fixture: bars now render the rule navy #1E2761 with column x-positions matching GT exactly (Total column values at x=494.5 vs GT 494.0).

Related issue

Fixes #371

Testing

  • cargo test --workspace — green
  • Local bulk regression gate — PASS
  • New regression test test_cond_fmt_data_bar_color_from_start_end_tag_children (rewrites <cfvo/>/<color/> into start/end pairs and asserts the IR bar color and fill percent)
  • umya fork: new unit tests read_child_elements_with_end_tags / read_child_elements_self_closing, full fork suite green
  • Converted 06_sales_dashboard_en.xlsx: bars render navy, matching Excel

Visual impact

  • No rendered PDF change
  • Rendered PDF change or visual evidence added
  • Reason:

Visual audit

Visual comparison

GT Before After
GT Before After

Required inspection

  • Rendered all evidence at 150 DPI or higher
  • Stored progressive JPEG quality 86 assets with metadata stripped
  • Inspected matched region crops at full resolution
  • Ran the 5% fuzz pixel-difference sweep
  • Inventoried hairlines and border dash styles
  • Inventoried font weight, italic, and underline emphasis

Deviation audit

Check Result
Page count/order Matches GT
Element presence Matches GT
Position/size Remaining: #396 (auto-height rows render 17.15pt pitch vs GT 14.0pt)
Rotation/flip No deviation observed
Fill Fixed (bars use the rule navy #1E2761 instead of default blue)
Stroke/border Matches GT
Text content Matches GT
Font family/weight/style Matches GT
Text color Matches GT
Alignment Matches GT
Line/paragraph spacing No deviation observed
Clipping/overflow No deviation observed

Checklist

  • Commits include a Signed-off-by line
  • PR scope contains one root cause
  • Remaining visual deviations each reference an open issue

🤖 Generated with Claude Code

Data bars fell back to the default steel blue when the rule's <color>
(and <cfvo>) children were written as start/end pairs instead of
self-closing tags — umya-spreadsheet's DataBar reader only matched
Event::Empty, so the color collection came back empty (issue #371).
The reader fix lands in the umya-spreadsheet fork (branch
fix/panic-safety-v2, upstreamed as MathNya/umya-spreadsheet#347); this
change pins the behavior with a regression test that rewrites the
fixture XML into the start/end-tag form before parsing.

Also ships the side-by-side comparison for follow-up defect #396
(auto-height rows render taller than Excel).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
@developer0hye
developer0hye merged commit 872a031 into main Jul 21, 2026
15 checks passed
@developer0hye
developer0hye deleted the fix/xlsx-databar-color branch July 21, 2026 22:58
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.

XLSX: data bar ignores the rule color and falls back to default blue

1 participant