Fix styled stream pivot fields and formula XML - #184
Merged
Zncl2222 merged 2 commits intoMay 10, 2026
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 35 |
| Duplication | 14 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
zfuchen
force-pushed
the
fix-styled-stream-pivot-fields-formulas
branch
from
May 8, 2026 08:28
a161170 to
f85d88d
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #184 +/- ##
==========================================
+ Coverage 86.14% 86.44% +0.30%
==========================================
Files 8 8
Lines 837 841 +4
==========================================
+ Hits 721 727 +6
+ Misses 78 75 -3
- Partials 38 39 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Zncl2222
force-pushed
the
fix-styled-stream-pivot-fields-formulas
branch
from
May 10, 2026 12:13
51dd187 to
47c82da
Compare
Zncl2222
force-pushed
the
fix-styled-stream-pivot-fields-formulas
branch
from
May 10, 2026 12:16
47c82da to
8fe73a1
Compare
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
This fixes two regressions in the StreamWriter + PivotTable path after the large streamed data range fix in #183:
AddPivotTable.=.Root Cause
seedPivotSourceHeadersreads the source header row fromew.Content[sheet]["Data"]and seeds those values back into excelize soAddPivotTablecan validate fields after streamed worksheets are flushed.For styled StreamWriter sheets,
performStreamWritemutates each styled cell from the original[]interface{}{value, style}into anexcelize.Cell. The previousgetCellScalarValueonly unwrapped[]interface{}and returned any other value as-is. As a result, styled header cells were written back as struct values such as:Those names no longer matched the PivotTable field definitions, so pivot cache fields could be malformed and
pageFields,rowFields, ordataFieldscould be missing from the generated pivot table XML.Separately, formulas were passed to excelize with the leading
=included. Excelize expects formula text without that leading=, otherwise worksheet XML can contain invalid formulas like<f>=SUM(A2:A3)</f>.Changes
excelize.Cell.ValueingetCellScalarValue.normalizeFormulaand strip one leading=before setting formulas in both StreamWriter and NormalWriter paths.excelize.Cellscalar extraction.=.Validation
Both commands pass locally.
I also validated the generated shared library against a representative styled StreamWriter pivot workbook. Without any Python-side OOXML repair, the generated workbook now has:
Category,Amount,RegionpageFields,rowFields, anddataFields=in<f>XML nodes