Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions docs/conformance.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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 |

Expand Down
3 changes: 2 additions & 1 deletion packages/javascript-excel/src/sheet-names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
2 changes: 1 addition & 1 deletion packages/javascript-excel/test/conformance/checklist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`,
"",
Expand Down
2 changes: 1 addition & 1 deletion packages/javascript-excel/test/conformance/corpus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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\").",
},
],
},
Expand Down
5 changes: 5 additions & 0 deletions packages/javascript-excel/test/write/writer-features.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading