Repository navigation
Conversation
The reader always made the first visible sheet active, so a workbook saved on its second sheet opened, and exported by default, on the first. It now reads the active tab from the workbook's first book view ([MS-XLSB] BrtBookView itabCur), mapped past sheets the import skips; with no book view, an index off the list or a hidden tab, it falls back to the first visible sheet as before. Fixes storytold#4300.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Upstream PR: storytold#4376 Head: fefdb62
Merges the zcode-pr-transfer branch (61 commits transferring open, not-yet-merged upstream PRs into our fork) into main. Docs (docs/ui-parity.md, docs/file-format-parity.md) resolved in favor of main's current changelog state; code from all transferred PRs carried over cleanly. Commits carried over (21 from this session + 40 earlier transfers): storytold#4408, storytold#4405, storytold#4406, storytold#4386, storytold#4379, storytold#4378, storytold#4376, storytold#4375, storytold#4373, storytold#4370, storytold#4369, storytold#4348, storytold#4347, storytold#4345, storytold#4344, storytold#4343, storytold#4341, storytold#4340, storytold#4337, storytold#4336, storytold#4318, storytold#4316, storytold#4315, storytold#4312, storytold#4310, storytold#4307, storytold#4306, storytold#4305, storytold#4303, storytold#4298, storytold#4295, storytold#4287, storytold#4286, storytold#4257, storytold#4256, storytold#4254, storytold#4252, storytold#4251, storytold#4248, storytold#4244, storytold#4243, storytold#4229, storytold#4228, storytold#4227, storytold#4225, storytold#4221, storytold#4220, storytold#4219, storytold#4217, storytold#4424, storytold#4423, storytold#4420, storytold#4419, storytold#4418, storytold#4414, storytold#3617, storytold#2642, storytold#2556, storytold#2321
Fixes #4300
What was wrong
read_xlsbincrates/xlsx/src/xlsb.rsalways made the first visible sheet active. A workbook Excel saved on its second sheet opened on the first, andgridcraft-cli convert … output.csvexported the first sheet by default. That's the issue'sFIRSTwhere Excel and the XLSX and XLS paths giveSECOND.What changed
workbookalso reads the workbook's first book view (BrtBookView, record 158, from Microsoft's published [MS-XLSB] 2.4.304). It takesitabCur, the zero-based index of the active tab in the workbook's sheet list, which is the tab Excel opens on. The other fields are read past.QA report
Main vs branch, end to end (
gridcraft-cli)second.xlsbandfirst.xlsbare minimal XLSB packages I wrote in Python, following the record layout this crate's tests use. Each has the issue's two sheets,FirstandSecond, with A1 holding the sheet's name in capitals. They differ only in the book view's active tab:SecondandFirst. I didn't have Excel to save real.xlsbfiles. I ran the issue's commands,gridcraft-cli info <file> --jsonandgridcraft-cli convert <file> out.csv.mainis agridcraft-clibuilt fromorigin/main(abcfc191); the branch is this PR (fefdb623). The Excel column is the issue's result.activeSheet/ CSV first fieldsecond.xlsb(saved onSecond)FIRSTSECONDSECONDfirst.xlsb(saved onFirst, control)FIRSTFIRSTsecond.xlsbwith--sheet Second(control)SECONDSECONDTest
tests::xlsb_tests::xlsb_opens_on_the_sheet_it_was_saved_oncovers:The other XLSB tests (values, visibility, epochs, damaged packages) still pass.
Negative control
With the saved tab ignored (on top of
fefdb623, then restored withgit checkout), the test fails at its first assertion: left"First", right"Second".Gate (macOS arm64)
cargo fmt --all -- --checkcargo clippy -p gridcraft-xlsx --all-targets -- -D warningscargo test -p gridcraft-xlsx -p gridcraft-engineNot covered
.xlsbfiles are ones I wrote. The record follows the published specification, and the field layout matches the one documented there.BrtSel, the active cell) isn't imported. The issue concerns the active sheet.cargo xtask ci: I didn't run the fullcargo xtask ci(wasm, layers, the other crates).Summary by CodeRabbit