Other utilities

Anything else exported from the public surface.

1 export from 1 source file

Cell text

src/utils/cell-text.ts

MAX_CELL_TEXT_LENGTH const

src/utils/cell-text.ts:27

How much text Excel accepts in one cell, in UTF-16 code units: the unit String.length counts and the one Excel's own LEN reports. A longer string is written without complaint by every tool that does not check, and Excel then reports the workbook as needing repair.

The unit is code units rather than characters, which decides the astral case: 16_384 emoji are 16_384 characters but 32_768 code units, and Excel refuses that cell the same way it refuses 32_768 letters.

Exported so a caller with text of unknown length can shorten it ahead of the write rather than discover the ceiling from a thrown error. A slice must keep a surrogate pair together: splitting one leaves a lone surrogate, which the XML escaper rejects further down with an error about the pair rather than about the length.

const MAX_CELL_TEXT_LENGTH: 32767