Retain style-only cells by default (skipStyledEmptyCells to opt out) - #84
Merged
Conversation
Cells that carry only a style/number-format but no value or formula (e.g. <c r="C2" s="1"/>, a blank cell pre-formatted with a date number format) were silently dropped by handlerCell's empty-cell check, losing the number format on import. keepStyledEmptyCells (default off, preserving current behavior) opts into emitting these cells with their style attached and no v/f/dt, so downstream consumers can preserve the intended format when later writing a value or formula into the cell.
…ells Invert the earlier keepStyledEmptyCells opt-in: style-only cells (a style but no value/formula/data table) are now kept on import by default so the number format is preserved. skipStyledEmptyCells opts back into dropping them, unless the style has visible formatting such as a fill or border.
steinnes
marked this pull request as ready for review
July 6, 2026 15:06
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.
What
Cells that carry a style but no value, formula, or data table (e.g.
<c r="C2" s="1"/>, a blank cell pre-formatted with a date number format) are now retained on import. A newskipStyledEmptyCellsoption (defaultfalse) drops them.Why
handlerCell's empty-cell check silently dropped such cells, losing the number format on import. Keeping them preserves the format so it survives when a value or formula is later written into the cell.How
v/f/dt.skipStyledEmptyCellsdrops them again, unless the style has visible formatting (fill, border, etc.).