feat(excel): row-height autofit — row and sheet level - #388
Open
ylz92871-dotcom wants to merge 2 commits into
Open
ylz92871-dotcom wants to merge 2 commits into
ylz92871-dotcom wants to merge 2 commits into
Conversation
What: 'autofit=true' now works on rows, mirroring the column autofit: officecli set data.xlsx '/Sheet1/row[7]' --prop autofit=true officecli set data.xlsx /Sheet1 --prop autofit=true # columns, then rows Heuristic (no rendering engine): per cell, wrapped lines = sum over the cell's newline segments of ceil(display width / effective column width); row height = max-lines × 15pt line pitch (11pt Calibri default), clamped to Excel's 15-409pt range, written with customHeight=true. The sheet-level form runs columns FIRST, then rows — the wrap estimate depends on the final column widths. Why: agents had column autofit but no row-height story — wrapped/CJK rows clipped with no recovery except hand-computed heights (the 40-city KPI row needed two rounds of manual tuning). Excel's in-app autofit stays available for font-exact sizing. How to verify: set a 60-char string in A1, then set '/Sheet1/row[1]' --prop autofit=true → row height 120pt (8 wrapped lines × 15pt), customHeight set single-line row → 15pt; sheet-level → columns widen, rows re-fit after validate clean Local harness T-07: 4 suites / 9 assertions green (wrapped, CJK, single-line, sheet-level order, numeric_overflow suggestion intact).
What: schemas/help/xlsx/row.json gains the `autofit` property declaration for the row-level autofit this feature adds, and sheet.json documents the sheet-level `autofit` (columns first, then rows) that previously existed in code without a schema entry — matching column.json, which already declares column autofit. Why: schemas/help is the machine-readable help layer downstream automation pins (plugins doctor validates props against it); a settable prop absent from the schema reads as an unknown property to those consumers. Code behavior and SKILL.md were already correct — this closes the help-layer gap. How to verify: officecli help xlsx row | grep autofit # entry renders officecli help xlsx sheet | grep autofit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
autofit=truenow works on rows, mirroring the column autofit:Heuristic (no rendering engine): per cell, the wrapped line count is the sum over the cell's newline segments of ceil(display width / effective column width); the row height is max-lines × 15pt line pitch (11pt Calibri default), clamped to Excel's 15-409pt range, written with
customHeight=true. The sheet-level form runs columns FIRST, then rows — the wrap estimate depends on the final column widths.Why
Agents had column autofit but no row-height story: wrapped/CJK rows clipped with no recovery except hand-computed heights (a real 40-city KPI row needed two rounds of manual tuning). Excel's in-app autofit stays available for font-exact sizing; this gives the CLI a sane default.
Implementation
CalculateAutoFitHeight+AutoFitAllRowsinExcelHandler.Set.RowsCols.cs(next to the existing column autofit, reusingGetCellDisplayValue+ParseHelpers.EstimateTextWidthInChars, incl. its CJK width table).set row[N] --prop autofit=truecase in the row property switch; sheet-levelautofitextended to rows after columns.How to verify
Local harness T-07: 4 suites / 9 assertions green (wrapped, CJK, single-line, sheet-level order, numeric_overflow suggestion intact).