mirror of
https://github.com/storytold/gridcraft.git
synced 2026-12-02 10:37:05 -06:00
Format: number formats widen columns that weren't sized by hand (#1077)
Increase/Decrease Decimal and the ribbon's other number formats widened the format but never the column, so the number turned into ####. A column nobody sized by hand now widens to the widest number in the target, as observed in Excel 16.0: AutoFit counts as automatic, Column Width (or dragging the border) as by hand; hidden columns, text, General numbers, merged and shrink-to-fit cells don't widen; columns never narrow. LineInfo::custom now marks columns set by hand too. XLSX reads and writes it as Excel does (customWidth without bestFit = by hand; automatic widths get bestFit and customWidth), and .xls reads COLINFO's fUserSet and fBestFit the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
06920de8da
commit
f3a7c72bb6
+29
-1
@@ -79,4 +79,32 @@ to 115% or 100%. That's a large relative step at low zoom and a small one near 4
|
||||
relative steps keep each notch feeling the same, and the doublings land on 25, 50, 100, 200 and
|
||||
400%. The status bar's Zoom In / Zoom Out buttons and Ctrl+Alt+= / Ctrl+Alt+- keep their 10%
|
||||
steps, so the wheel and the buttons now step differently. Whether they should share one ladder
|
||||
(this one, Excel's, or another) is left to the maintainers.
|
||||
(this one, Excel's, or another) is left to the maintainers.
|
||||
## Number formats widen columns that weren't sized by hand (#1077)
|
||||
|
||||
Increase/Decrease Decimal and the ribbon's other number formats (the Number Format list, Accounting,
|
||||
Percent, Comma) widen a column so the formatted numbers in the target fit, instead of showing `####`.
|
||||
Microsoft's support article "Stop showing rounded numbers" says only that "the column width adjusts
|
||||
automatically", so the rule comes from observing Excel 16.0 (build 17932, Windows) with synthetic
|
||||
workbooks:
|
||||
|
||||
- A column at the default width, AutoFitted, or widened this way before widens to the widest number
|
||||
in the formatted range, also with Wrap Text and a large bold font. It never narrows.
|
||||
- A width set with Column Width (or by dragging the border) stays, even when it equals the default:
|
||||
the number shows `####`. AutoFit makes such a column automatic again.
|
||||
- Hidden columns, text, General numbers (they round to fit instead), merged cells and shrink-to-fit
|
||||
cells don't widen.
|
||||
- In XLSX, Excel writes `customWidth="1"` for every width it stores and adds `bestFit="1"` for widths
|
||||
that AutoFit or a number format set. Only `customWidth` without `bestFit` is read as set by hand: a
|
||||
width with no flags, `bestFit` alone, or both, keeps widening after the file is opened again.
|
||||
|
||||
`LineInfo::custom`, already used for rows set by hand, now marks columns set by hand too; GridCraft
|
||||
writes and reads the two flags as Excel does (and `.xls` COLINFO's fUserSet and fBestFit alike).
|
||||
Files that earlier GridCraft versions saved have `customWidth` without `bestFit` on every stored
|
||||
width, so those columns open as set by hand and keep their width.
|
||||
|
||||
The engine has no font metrics, so the width is the same estimate AutoFit Column Width uses, which
|
||||
errs on the wide side; a UI test checks that the real font then draws the number, not `####`.
|
||||
Excel also widens when a number format is set another way (observed through the `NumberFormat`
|
||||
property, as Format Cells sets it); GridCraft's Format Cells doesn't yet. That, and typing a number
|
||||
into a formatted cell, are left for later.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# File-format parity
|
||||
|
||||
> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-21 · **Change:** minor (.xls dialog sheets are skipped instead of read as worksheets; `.xls` import reads each sheet's display options from WINDOW2: right-to-left, gridlines, headings, zeros, formulas; XLSX text boxes and shapes keep their paragraphs' right-to-left direction on save; CSV/TSV/TXT can open with every field kept as text via `file.open {csvAsText}`; formulas over Excel's 8,192 characters, and `%` or call chains past the nesting limit, are parse errors instead of stack overflows when a file is opened; XLSX PivotTables read and write `rowGrandTotals`/`colGrandTotals` the way Excel does, so a table saved with only one grand total opens with the right one; HTML export keeps right-to-left; CSV and text import detects likely Windows-1256 Arabic when invalid UTF-8 has Arabic byte runs; other invalid UTF-8 remains Windows-1252; HTML export places pictures and charts, as inline SVG, at their anchors) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4
|
||||
> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-22 · **Change:** minor (XLSX and `.xls` column widths keep whether they were set by hand, so automatic ones still widen for wider number formats, #1077; .xls dialog sheets are skipped instead of read as worksheets; `.xls` import reads each sheet's display options from WINDOW2: right-to-left, gridlines, headings, zeros, formulas; XLSX text boxes and shapes keep their paragraphs' right-to-left direction on save; CSV/TSV/TXT can open with every field kept as text via `file.open {csvAsText}`; formulas over Excel's 8,192 characters, and `%` or call chains past the nesting limit, are parse errors instead of stack overflows when a file is opened; XLSX PivotTables read and write `rowGrandTotals`/`colGrandTotals` the way Excel does, so a table saved with only one grand total opens with the right one; HTML export keeps right-to-left; CSV and text import detects likely Windows-1256 Arabic when invalid UTF-8 has Arabic byte runs; other invalid UTF-8 remains Windows-1252; HTML export places pictures and charts, as inline SVG, at their anchors) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4
|
||||
|
||||
Every format Excel opens or saves, with GridCraft's read and write support, fidelity and tests.
|
||||
Part of [target-app-parity.md](target-app-parity.md). **File formats: ~50% ready, 80–120 h**
|
||||
@@ -110,6 +110,7 @@ refresh. Counted under features (Get & Transform, ~10% ready), not here.
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-22 | minor | XLSX column widths: `customWidth` without `bestFit` is a width set by hand, others (AutoFit, widened by a number format) are automatic, as Excel 16.0 reads them; written the same way (`bestFit="1" customWidth="1"` for automatic widths). `.xls` reads COLINFO's fUserSet and fBestFit alike (#1077) |
|
||||
| 2026-10-21 | minor | HTML (Save as Web Page) writes pictures (`data:` URI `<img>`) and charts (inline SVG from the chart crate's drawing primitives, text included) at their anchors; the table uses the sheet's column widths and row heights when the sheet has either, and output for sheets without pictures or charts is unchanged |
|
||||
| 2026-10-20 | trivial | XLSX shared strings: Japanese phonetic runs (ふりがな, `<rPh sb="…" eb="…">` with `<phoneticPr>`) are read into the workbook and written back next to the string with the same text, so an open + save no longer deletes them; bad offsets and readings are dropped with a warning, a `<phoneticPr>` without runs is kept on its own, and when duplicate `<si>` items share a text but not a reading only the first reading is written (reported on open) (`phonetic_tests.rs`) |
|
||||
| 2026-10-20 | minor | A workbook theme's major/minor per-script typefaces (`<a:font script="Arab" typeface="…"/>`, also Hebr, Jpan and the rest) are read and written back in file order after `<a:cs>`; they were dropped before. A hostile file is held to 64 entries of 256 characters |
|
||||
|
||||
+2
-1
@@ -1,6 +1,6 @@
|
||||
# UI parity
|
||||
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-21 · **Change:** minor (Esc and Enter close a data validation alert over the cell editor; Ctrl+Enter fill gives each cell the automatic number format typing gives it; keytip letters typed with Alt held, #1846; Number Stored as Text indicator and Convert to Number) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-22 · **Change:** minor (ribbon number formats widen columns nobody sized by hand, #1077; Esc and Enter close a data validation alert over the cell editor; Ctrl+Enter fill gives each cell the automatic number format typing gives it; keytip letters typed with Alt held, #1846; Number Stored as Text indicator and Convert to Number) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4
|
||||
|
||||
Interaction, controls and feel, against Excel. Part of [target-app-parity.md](target-app-parity.md).
|
||||
**UI/UX fidelity: ~55% ready, 50–80 h** (estimated). Ribbon command coverage is measured
|
||||
@@ -176,6 +176,7 @@ scrollbar bugs 2–4 · pixel/feel pass against observed Excel 7–12.
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-22 | minor | Increase/Decrease Decimal and the ribbon's other number formats (Number Format list, Accounting, Percent, Comma) widen a column nobody sized by hand so the numbers fit, instead of showing #### (#1077). As observed in Excel 16.0: AutoFit counts as automatic, Column Width or dragging the border as by hand; hidden columns, text, General numbers, merged and shrink-to-fit cells don't widen, and columns never narrow |
|
||||
| 2026-10-21 | minor | Background error checking, first part (#1994): a constant whose text would be a number if typed (signs, thousands, currency, percent, exponent, parenthesised negative) gets Excel's green corner triangle; the active cell then shows a warning button whose menu names the problem and offers Convert to Number for the selection (`formulas.convertToNumber`). Dates, times and fractions kept as text and formula results are not flagged, as in Excel |
|
||||
| 2026-10-21 | minor | Paste Special laid out as Excel's: Paste and Operation options each in two columns inside a frame, Skip blanks and Transpose side by side, Paste Link as a button that pastes references at once; labels translated (the generic form didn't translate them) and the window no longer runs past the screen |
|
||||
| 2026-10-21 | minor | Form dialogs (conditional-format quick rules, New Name, Remove Duplicates, Text to Columns and every other `Dialog::form`) fit their content: OK and Cancel sit in a row under the last field instead of a right-to-left layout that took the screen's whole height and left the buttons floating halfway down |
|
||||
|
||||
Reference in New Issue
Block a user