Skip to content

fix: preserve false stylesheet booleans - #210

Merged
baseballyama merged 1 commit into
mainfrom
fix/209-font-booleans
Oct 2, 2026
Merged

baseballyama merged 1 commit into
mainfrom
fix/209-font-booleans

Conversation

@baseballyama

Copy link
Copy Markdown
Member

Summary

Font toggles with val="0" or val="false" now stay disabled through load/save, and explicit false XF flags survive serialization.

Motivation

Closes #209

The font schema treated b, i, strike, outline, shadow, condense and extend as presence-only markers, ignoring their val attributes. SpreadsheetML's CT_BooleanProperty uses a boolean attribute with a default of true; the existing nested-boolean schema already models this distinction. The XF writer separately discarded false flags through truthiness checks.

The regression fixture uses the report's stylesheet, with a differential font added to exercise the shared font schema. XML is preserved semantically, not byte-for-byte: true font values serialize as val="1".

Changes

  • Parse all seven font toggles as booleans, preserving absent elements and defaulting bare elements to true.
  • Preserve explicit false values in regular/differential fonts and both XF tables.
  • Add a patch changeset and correct the schema comments describing font toggles.

Testing

  • Regression: pnpm test tests/styles/issue-209.test.ts — 45 failures before the fix, all 75 cases pass afterward.
  • Covers all four XML boolean spellings, bare/absent elements, whitespace, invalid values, both XF tables, normal/streaming loading, editing and saving. Input and saved XLSX pass OPC/XSD/semantic validation.
  • Full suite: 3,271 tests pass; performance gate: 16 tests pass.
  • pnpm lint, pnpm typecheck, pnpm knip, pnpm build, pnpm size, pnpm check:attw and pnpm check:consumer pass.

Breaking changes

None

Checklist

  • I have read CLAUDE.md and followed the project's conventions.
  • I have added or updated tests for the change.
  • I have added or updated documentation where user-visible behavior changed.
  • If this is a user-visible change, I have run pnpm changeset and committed
    the result.
  • If this is a breaking change, I have flagged it above and the changeset is
    marked accordingly.
  • I have re-read my own diff and removed dead code, debug prints, and stale
    comments.
  • If I used an LLM to draft this PR, I have verified each change myself, this
    PR represents real work that warrants a maintainer's review, and I am
    willing to defend each line in review.

Copilot AI balanced review requested due to automatic review settings October 2, 2026 01:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@baseballyama
baseballyama merged commit a124169 into main Oct 2, 2026
14 checks passed
@baseballyama
baseballyama deleted the fix/209-font-booleans branch October 2, 2026 01:46
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.

bug: styles.xml parsing does not seem to follow the SpreadsheetML Schema which results in messed up styles

2 participants