mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-20 09:09:35 +02:00
The XLSX preview hands an admitted copy of the workbook to ExcelJS 4.4.0, which links each worksheet to its comments, comment notes (VML), tables and drawing by looking the relationship Target up verbatim in maps keyed by its own spelling, then dereferences the result unchecked. openpyxl, the library most agents write .xlsx files with, uses absolute Targets (/xl/tables/table1.xml), its own comment part name (xl/comments/comment1.xml, which ExcelJS never loads) and a drawing XML ExcelJS parses to nothing. One comment, table or chart was enough for "Spreadsheet preview failed". repairExcelJsModel() (spreadsheet-xlsx-core.js) runs on ExcelJS's parsed model right before its reconcile: it re-points a link to the key ExcelJS stored for the same part (so an openpyxl table is kept) and drops a link, tablePart, drawing or hyperlink reference that would dereference nothing. It adds nothing and resolves keys as own properties only. The worker wraps workbook.xlsx.reconcile per instance to call it, and throws if a future ExcelJS renames that method. SPREADSHEET_ASSET_VERSION is refreshed. Tests: unit tests on model objects, and three real openpyxl 3.1.5 workbooks in test/fixtures/xlsx that fail the worker tests without the hook. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
287 B
287 B
aicodeman
| aicodeman |
|---|
| patch |
Spreadsheet preview: workbooks written by openpyxl (the Python library most agents use to make .xlsx files) now open when they contain a cell comment, a table or a chart. Before, any one of those made the whole preview fail with "Spreadsheet preview failed".