feat: Format profiling, VBA, tables, data utils, sheet views#16
Conversation
…ltx/xltm/xlam) Introduce explicit workbook format detection and preservation across the open/save cycle. The format is inferred from the workbook content type in [Content_Types].xml during open, stored on the Workbook struct, and used to emit the correct content type on save. This enables round-trip fidelity for macro-enabled workbooks, templates, and add-ins. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add high-level data conversion methods to the Workbook class for common developer workflows. These methods use getRowsBuffer/SheetData internally for efficient buffer-based data access without unnecessary re-parsing. - toJSON(sheet, options?) - convert sheet data to array of objects - toCSV(sheet, options?) - convert sheet data to CSV string - toHTML(sheet, options?) - convert sheet data to HTML table string - fromJSON(sheet, data, options?) - write array of objects to sheet Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ring
Upgrade table support from auto-filter helper level to full table part
management. Tables are now stored as proper xl/tables/table{N}.xml parts
with correct worksheet relationships, content type overrides, and
tableParts references in the worksheet XML.
New capabilities:
- add_table(): creates table XML part with columns, style, auto-filter
- get_tables(): lists table metadata for a sheet
- delete_table(): removes table by name with full cleanup
- Round-trip persistence: tables survive save/open/re-save cycles
- Sheet deletion properly cleans up associated tables
XML schema: new sheetkit-xml::table module with TableXml, TableColumnXml,
TableStyleInfoXml, and TableAutoFilter serde types.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…workbooks Load xl/vbaProject.bin as opaque bytes during open and write it back unchanged on save. Synchronize the VBA content type override and workbook relationship entry so the blob is correctly referenced in the output package. Non-VBA workbooks are unaffected. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add SheetViewOptions (show_gridlines, show_formulas, show_row_col_headers, zoom_scale, view_mode, top_left_cell) and SheetVisibility (Visible, Hidden, VeryHidden) with get/set methods on Workbook. Includes XML schema updates, core business logic, Node.js napi bindings, TypeScript wrapper, and tests across all layers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When saving to a file, the target format is now inferred from the output file extension (.xlsx/.xlsm/.xltx/.xltm/.xlam). This ensures the content type in [Content_Types].xml always matches the file extension. - Add WorkbookFormat::from_extension() with case-insensitive matching - Add UnsupportedFileExtension error variant for unrecognized extensions - Modify save() to validate and apply the extension-derived format - save_to_buffer() continues to use the stored format unchanged - Add comprehensive tests for each extension and error cases Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts: # crates/sheetkit-core/src/workbook/io.rs # crates/sheetkit-core/src/workbook/mod.rs
# Conflicts: # crates/sheetkit-core/src/workbook/features.rs # packages/sheetkit/__test__/index.spec.ts # packages/sheetkit/index.ts
…tegration tests Expose getFormat() for workbook format detection (xlsx/xlsm/xltx/xltm/xlam), and addTable/getTables/deleteTable for table management via the napi layer. Add cross-feature integration tests covering format + tables + views + styles + defined names + validation + sheet protection combinations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Cover workbook format profiling, VBA preservation, extension-based save, table CRUD, data conversion utilities, sheet view options, and sheet visibility across API reference and user guide sections. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Code ReviewFound 2 issues that need attention: 1. Korean Comments in Documentation Code Blocks (CLAUDE.md Violation)Korean comments appear in code blocks within Korean documentation. According to CLAUDE.md line 64: Documentation prose may be in other languages (e.g., Korean guide), but all code blocks within documentation must use English. Examples:
Files affected:
Fix: Replace all Korean comments in code blocks with English equivalents. Reference: Line 64 in 3a73b68 2. Table Path Collision Bug (Critical)The table ZIP path computation uses self.tables.len() + 1, which can cause path collisions after table deletion. Location: crates/sheetkit-core/src/workbook/features.rs:123 Reproduction:
This causes ZIP entry collision and data corruption when saving. Suggested fix: Use monotonically increasing path numbers similar to table_id computation. Reference: sheetkit/crates/sheetkit-core/src/workbook/features.rs Lines 120 to 126 in 3a73b68 |
|
I reviewed the Phase A workstream branches ( Findings (ordered by severity):
Branch-level summary:
If helpful, I can follow up with concrete patch suggestions for each item. |
…rts, fromJSON key union, visibility validation, Biome formatting) - Fix table path collision after deletion by using max existing path number - Clear stale tableParts from worksheet XML when all tables are deleted - Collect keys from all records in fromJSON, not just the first object - Return error for invalid visibility strings instead of silent default - Remove unimplemented includeStyles option from ToHtmlOptions - Fix Biome formatting in index.ts and index.spec.ts - Add regression tests for all fixed issues Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CLAUDE.md requires all code blocks in documentation to use English. Replace ~128 Korean inline comments across 6 Korean doc files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…valents" This reverts commit 3fd3e31.
Update CLAUDE.md language policy to permit Korean inline comments in code blocks within docs/ko/ for reader comprehension. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Phase A delivers 6 new feature groups that close critical gaps vs SheetJS/excelize:
WorkbookFormatenum (xlsx/xlsm/xltx/xltm/xlam), auto-detection on open, correct content type on savevbaProject.binfor macro-enabled filessave()infers target format from file extension, rejects unsupported extensionstoJSON,toCSV,toHTML,fromJSONhelpers (Node.js)addTable,getTables,deleteTablewith OOXML relationship/content-type wiringsetSheetViewOptions,getSheetViewOptions,setSheetVisibility,getSheetVisibilityTest Coverage
Commits
6574a3b255e5fafe55d480395635c2fa48dbb8ee2bf8575773a73b68Documentation
Verification
cargo build --workspacecargo test --workspace(1521 tests)cargo clippy --workspace(no warnings)cargo fmt --checkpnpm build(napi + typecheck + tsdown)pnpm test(321 tests)Test plan
🤖 Generated with Claude Code