Repository navigation
Fix prefixed worksheet content in the compatibility reader - #14
Merged
Merged
Conversation
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
developer0hye
added a commit
to developer0hye/office2pdf
that referenced
this pull request
Sep 27, 2026
A worksheet may bind the SpreadsheetML URI to a prefix instead of making it the default namespace. Excel writes and accepts both spellings, and the two packages are equivalent XML: identical expanded element names, attributes and text. The dependency's worksheet reader matched literal `e.name()` values such as `row` and `headerFooter`, so `s:row` and `s:headerFooter` matched nothing. Every sheet element was skipped, the converter reported success, and the page came out blank — body cells, header and footer all gone. The fix is a streaming `NsReader` adapter in the dependency (developer0hye/umya-spreadsheet#14, upstream MathNya/umya-spreadsheet#371) that resolves each event's namespace and hands the legacy sub-readers the unqualified local name when, and only when, the URI is SpreadsheetML. Elements in a foreign namespace take an internal prefix so the legacy parser cannot mistake their local names for worksheet elements. It buffers one event, so worksheet streaming is preserved, and the stored source XML is untouched. Only the lock's `source` line moves; the fork delta over the previous pin is that adapter, its wiring and its tests. The regression test pins the rule rather than the reported input: it reads the committed `s:`-prefixed fixture and four more prefixes generated from the default-namespace control, including `row:`, which a substring-matching reader would still get wrong. Both the whole-document and the streaming parse paths are checked for every body value, the header, and the footer's three sections with their page-number fields. The prefixed and default-namespace packages now convert to a byte-identical PDF, and the default-namespace output is unchanged. Related: #1803 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
This was referenced Sep 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Port the worksheet namespace-resolution fix from MathNya#371 to the 2.3.3 compatibility branch used by office2pdf. Prefixed SpreadsheetML cells and header/footer content currently disappear during normal and lite/lazy reads.
The bounded event adapter resolves element namespaces before the existing worksheet sub-readers dispatch on their names. It preserves source XML, nested namespace scope, entities and CDATA, and keeps foreign-default-namespace local names out of the worksheet parser. No dependencies or public APIs change.
Related: developer0hye/office2pdf#1803, MathNya#370.
Validation
cargo test --locked: 157 passed.cargo clippy --locked -- -D warnings,cargo fmt --all -- --check, andgit diff --check: passed.The upstream optimized benchmark measured approximately 1.6% additional normal-read time and 34.1% additional callback-streaming-read time for 40,000 cells on the test host. That result is disclosed in upstream PR MathNya#371; this older fork has no equivalent callback-streaming API, so those timings are not a measurement of this branch. The extra namespace pass is an explicit performance tradeoff.