Skip to content

fix: read dataBar cfvo and color children written as start/end tags#347

Merged
MathNya merged 1 commit into
MathNya:masterfrom
developer0hye:fix/data-bar-start-events
Jul 22, 2026
Merged

fix: read dataBar cfvo and color children written as start/end tags#347
MathNya merged 1 commit into
MathNya:masterfrom
developer0hye:fix/data-bar-start-events

Conversation

@developer0hye

Copy link
Copy Markdown
Contributor

Summary

DataBar::set_attributes only matches Event::Empty for its <cfvo> and <color> children. Files written by producers that emit these as start/end pairs (<color rgb="FF1E2761"></color> — openpyxl among others) load with empty cfvo_collection and color_collection, so the data bar's color is silently lost.

ColorScale::set_attributes already handles both event kinds; this PR applies the same pattern to DataBar.

Changes

  • Match Event::Start in addition to Event::Empty for cfvo/color children of <dataBar>, passing the empty flag through to the child readers.
  • Unit tests covering both the start/end-tag form and the self-closing form.

Testing

  • cargo test — full suite green (87 + 112 + 4 + 79 passed).
  • New tests: structs::data_bar::tests::read_child_elements_with_end_tags, read_child_elements_self_closing.

Some producers (e.g. openpyxl) write <cfvo> and <color> inside <dataBar>
as <cfvo ...></cfvo> rather than self-closing <cfvo .../>. DataBar's
reader only matched Event::Empty, so both collections came back empty
and consumers lost the bar color. Match Event::Start as well, mirroring
ColorScale's reader.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
pull Bot pushed a commit to RadaKichenin/office2pdf that referenced this pull request Jul 22, 2026
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 developer0hye#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 developer0hye#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>
@MathNya

MathNya commented Jul 22, 2026

Copy link
Copy Markdown
Owner

@developer0hye
Thank you.
Since there were no issues with this either, I'll merge it.

@MathNya
MathNya merged commit 566f99f into MathNya:master Jul 22, 2026
5 checks passed
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