Skip to content

fix: XLSX export producing corrupted files in Excel#468

Merged
datlechin merged 2 commits intomainfrom
fix/xlsx-export-corrupted-464
Mar 26, 2026
Merged

fix: XLSX export producing corrupted files in Excel#468
datlechin merged 2 commits intomainfrom
fix/xlsx-export-corrupted-464

Conversation

@datlechin
Copy link
Copy Markdown
Collaborator

Summary

Fixes #464 — XLSX exports were corrupted when opened in Microsoft Excel (repair attempted but file appears empty).

Three issues in the custom XLSX writer:

  • Missing cellStyles element in styles.xmlcellXfs entries referenced xfId="0" with no corresponding cellStyles definition. Excel couldn't resolve the style mapping, entered repair mode, and dropped all styled cells (including headers), making the file appear empty.
  • No XML control character filtering — Illegal XML 1.0 control characters (0x00–0x08, 0x0B, 0x0C, 0x0E–0x1F) from binary/hex database columns produced malformed XML that Excel rejected entirely.
  • Wrong ZIP version field — Local file headers declared version 2.0 (deflate) but used store method (0). Strict ZIP validators reject this mismatch. Corrected to version 1.0.

Test plan

  • Export a MySQL table as XLSX, open in Microsoft Excel — verify data loads without repair prompt
  • Export a table containing special characters (accented, CJK, emoji) — verify correct rendering
  • Export a table with NULL values and binary data — verify no corruption
  • Open exported file in Numbers.app — verify still works (regression check)

@datlechin datlechin merged commit 557487d into main Mar 26, 2026
2 checks passed
@datlechin datlechin deleted the fix/xlsx-export-corrupted-464 branch March 26, 2026 12:56
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: XLSX Export corrupted

1 participant