diff --git a/docs/api.md b/docs/api.md index ff757e3..dd90f1f 100644 --- a/docs/api.md +++ b/docs/api.md @@ -230,7 +230,7 @@ export type ColumnWidth = number | { wch: number } | { wpx: number } | 'auto'; - is 1 to 31 characters long. Excel counts code points: it accepts 30 x's and ๐Ÿ˜€, which is 31 code points and 32 UTF-16 units *(confirmed in Excel for Mac, 2026-11-17; conformance.md, 17-workbook)*. The writer still counts UTF-16 units (`name.length`), so it rejects such a name although Excel accepts it; - contains none of `\ / ? * [ ] :`; - does not start or end with an apostrophe `'`; -- is not `History`, which Excel reserves `[to verify: not tried in the Excel for Mac check; conformance.md, 17-workbook]`. +- is not `History`, which Excel reserves: renaming a tab to it gives "History is a reserve word" *(confirmed in Excel for Mac, 2026-11-17; conformance.md, 17-workbook)*. The check ignores case (`history`, `HISTORY`); only `History` itself was tried in Excel. Names must be unique, compared case-insensitively (`DUPLICATE_SHEET_NAME`). `sanitizeSheetName()` (ยง4.6) makes any string valid. diff --git a/docs/conformance.md b/docs/conformance.md index e2d40dd..cb54c12 100644 --- a/docs/conformance.md +++ b/docs/conformance.md @@ -6,7 +6,7 @@ This checklist is for a one-time manual check of the conformance corpus in **Mic ## Results -Checked on 2026-11-17 in **Excel for Mac**: every file below opens with no repair prompt and was reported as passing. Eight of the open items were confirmed, two of them only in part. One (the Display sheet) was not reported. What was not checked is marked **Not verified** below. +Checked on 2026-11-17 in **Excel for Mac**: every file below opens with no repair prompt and was reported as passing. Eight of the open items were confirmed, one of them only in part. One (the Display sheet) was not reported. What was not checked is marked **Not verified** below. **Not checked by hand: Excel for Windows and Apple Numbers.** For those apps, only the automated checks apply: CI opens the corpus files in LibreOffice and reads them back with openpyxl and with javascript-excel's own reader ([Automated cross-checks](#automated-cross-checks)). Files saved by Excel, Numbers and Google Sheets (reader fixtures) and a file with a `#SPILL!` error were not made, so those items stay open. @@ -243,7 +243,7 @@ These facts were marked `[to verify]` in `docs/api.md`. Each one is checked by t | theme index order: 0 = lt1, 1 = dk1, 2 = lt2, 3 = dk2 (ยง3.5.6) | `12-colours.xlsx` | Theme!B2:B13 | Confirmed: 0 Background 1, 1 Text 1, 2 Background 2, 3 Text 2, 4โ€“9 Accent 1โ€“6, 10 Hyperlink, 11 Followed Hyperlink. | | indexed 64 = system foreground, 65 = system background (ยง3.5.6) | `12-colours.xlsx` | Indexed!C66:C67 | Confirmed: 64 is black, 65 is white. | | maximum digit width 7 px for Calibri 11 (ยง3.3) | `13-columns-rows.xlsx` | Widths!A:F | Confirmed in characters: A 8.43, B 10, C 20, D 12, E 8.43, F 13.57. Pixel widths are Windows values and were not checked. | -| 'History' is reserved; how the 31-character limit counts astral characters (ยง3.3) | `17-workbook.xlsx` | Any sheet tab | Confirmed: Excel accepts a name of 30 x's and ๐Ÿ˜€, 31 code points (32 UTF-16 units), so the limit counts code points. **Not verified:** renaming a sheet to History was not tried. | +| 'History' is reserved; how the 31-character limit counts astral characters (ยง3.3) | `17-workbook.xlsx` | Any sheet tab | Confirmed: Excel accepts a name of 30 x's and ๐Ÿ˜€, 31 code points (32 UTF-16 units), so the limit counts code points. Excel refuses to rename a sheet to History ("History is a reserve word"). | | 64,000 unique cell formats (ยง7.2, ยง11.1) | `18-limits.xlsx` | Opening the file | Confirmed: the file with 64,000 cell formats opens with no repair prompt, and Cmd+End goes to XFD1048576. A file over the limit was not tried. | | how newer Excel errors such as `#SPILL!` are stored (ยง3.4) | *(make one)* | In Excel 365, enter `=SEQUENCE(3)` in A2 and any value in A3 so it spills into a blocked cell, save as `.xlsx`, and attach the file to the report. The XML is inspected from it. | **Open**: no file was made | diff --git a/packages/javascript-excel/src/sheet-names.ts b/packages/javascript-excel/src/sheet-names.ts index 5ff653a..179a43d 100644 --- a/packages/javascript-excel/src/sheet-names.ts +++ b/packages/javascript-excel/src/sheet-names.ts @@ -3,7 +3,8 @@ * * Excel rejects names that are empty, longer than 31 characters, contain any * of \ / ? * [ ] :, or start or end with an apostrophe. It reserves 'History' - * [to verify]. Names are unique case-insensitively (checked by the writer). + * (Excel for Mac: "History is a reserve word"); the check here ignores case. + * Names are unique case-insensitively (checked by the writer). */ /** Why a sheet name is invalid. */ diff --git a/packages/javascript-excel/test/conformance/checklist.ts b/packages/javascript-excel/test/conformance/checklist.ts index 9749774..da6c543 100644 --- a/packages/javascript-excel/test/conformance/checklist.ts +++ b/packages/javascript-excel/test/conformance/checklist.ts @@ -13,7 +13,7 @@ export function renderChecklist(): string { "", "## Results", "", - `Checked on ${MANUAL_CHECK.date} in **${MANUAL_CHECK.checked.join(", ")}**: every file below opens with no repair prompt and was reported as passing. Eight of the open items were confirmed, two of them only in part. One (the Display sheet) was not reported. What was not checked is marked **Not verified** below.`, + `Checked on ${MANUAL_CHECK.date} in **${MANUAL_CHECK.checked.join(", ")}**: every file below opens with no repair prompt and was reported as passing. Eight of the open items were confirmed, one of them only in part. One (the Display sheet) was not reported. What was not checked is marked **Not verified** below.`, "", `**Not checked by hand: ${MANUAL_CHECK.notChecked.join(" and ")}.** For those apps, only the automated checks apply: CI opens the corpus files in LibreOffice and reads them back with openpyxl and with javascript-excel's own reader ([Automated cross-checks](#automated-cross-checks)). Files saved by Excel, Numbers and Google Sheets (reader fixtures) and a file with a \`#SPILL!\` error were not made, so those items stay open.`, "", diff --git a/packages/javascript-excel/test/conformance/corpus.ts b/packages/javascript-excel/test/conformance/corpus.ts index 979d1fd..cad6d24 100644 --- a/packages/javascript-excel/test/conformance/corpus.ts +++ b/packages/javascript-excel/test/conformance/corpus.ts @@ -657,7 +657,7 @@ export const CORPUS: CorpusEntry[] = [ look: "Rename a sheet to History. Then rename one to 31 characters made of 30 x's and one emoji (๐Ÿ˜€).", expect: "Record whether Excel refuses 'History' and whether it accepts the 31-character emoji name (if it does, Excel counts characters, not UTF-16 code units).", verifies: "'History' is reserved; how the 31-character limit counts astral characters (ยง3.3)", - result: "Confirmed: Excel accepts a name of 30 x's and ๐Ÿ˜€, 31 code points (32 UTF-16 units), so the limit counts code points. Not verified: renaming a sheet to History was not tried.", + result: "Confirmed: Excel accepts a name of 30 x's and ๐Ÿ˜€, 31 code points (32 UTF-16 units), so the limit counts code points. Excel refuses to rename a sheet to History (\"History is a reserve word\").", }, ], }, diff --git a/packages/javascript-excel/test/write/writer-features.test.ts b/packages/javascript-excel/test/write/writer-features.test.ts index eab8ad5..4f83021 100644 --- a/packages/javascript-excel/test/write/writer-features.test.ts +++ b/packages/javascript-excel/test/write/writer-features.test.ts @@ -280,6 +280,11 @@ describe("sheet names (ยง4.6)", () => { null, ]); }); + + it("rejects History in any case: Excel for Mac refuses it as a reserved word", () => { + expect(["History", "history", "HISTORY", "hIsToRy"].map(validateSheetName)).toEqual(["reserved", "reserved", "reserved", "reserved"]); + expect(["Histories", "History 2", " History"].map(validateSheetName)).toEqual([null, null, null]); + }); it("sanitizeSheetName always returns a valid name", () => { const cases = ["Q1/Q2 [draft]: *final?*", "'quoted'", "", "history", "x".repeat(40), `${"x".repeat(30)}๐Ÿ˜€`, "'''"]; const out = cases.map(sanitizeSheetName);