Skip to content

xlsx/xlsb: read Excel 4.0 macro sheets - #803

Open
NazarKalytiuk wants to merge 1 commit into
tafia:masterfrom
NazarKalytiuk:macro-sheets
Open

NazarKalytiuk wants to merge 1 commit into
tafia:masterfrom
NazarKalytiuk:macro-sheets

Conversation

@NazarKalytiuk

Copy link
Copy Markdown

Summary

Fixed issue where a workbook with an Excel 4.0 macro sheet or an international macro sheet failed to open.

  • Xlsx maps the xlMacrosheet and xlIntlMacrosheet relationship types to SheetType::MacroSheet. Before, it rejected the whole workbook with Unrecognized sheet:type: xl/macrosheets/sheet1.xml.
  • Xlsb maps sheet paths under xl/macrosheets/ to SheetType::MacroSheet. Before, it rejected the workbook with Unrecognized BoundSheet8:dt: xl/macrosheets/sheet1.bin.

Xls already reports these sheets as SheetType::MacroSheet. With this change, all three formats give the same sheets, values and formulas. The cell readers needed no changes: both read the cells of a macro sheet the same way as a worksheet.

Related issue

Fixes #802

Testing

test_all_macro_sheets reads tests/macro_sheets.{xlsm,xlsb,xls}. Each file is the same workbook: a Data worksheet, an Excel 4.0 macro sheet Macro1 (=ECHO(FALSE), =RETURN()) and an international macro sheet Intl1 (=RETURN()). @Alex-ley-scrub saved the files with Excel for Mac 16.115 and attached them to #802, unedited. For each format, the test checks the sheet metadata and the values and formulas of both macro sheets. Without the fix, the xlsm and xlsb cases fail with the errors above, and the xls case passes.

Checklist

  • cargo test --all-features passes.
  • cargo fmt -- --check passes.
  • cargo clippy --all-targets --all-features -- -Dwarnings passes.
  • New or changed behavior is covered by a test.
  • Code and tests follow CONTRIBUTING.md.

cargo +1.88 check --all-features and cargo check --target wasm32-unknown-unknown --all-features also pass. I didn't run typos locally.

🤖 Generated with Claude Code

Fixed issue where a workbook with an Excel 4.0 macro sheet or an
international macro sheet failed to open. Xlsx rejected the
xlMacrosheet and xlIntlMacrosheet relationships with "Unrecognized
sheet:type", and Xlsb rejected sheets under xl/macrosheets/ with
"Unrecognized BoundSheet8:dt". Both now report SheetType::MacroSheet,
as Xls already does, and their cells and formulas read like those of
the .xls file.

Fixes tafia#802

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

xlsx: workbooks with an Excel 4.0 macro sheet fail to open

1 participant