Skip to content
Sheetwrite

@sheetwrite/wasm

packTextsfunction

Report a problem

On this page

Pack strings into one UTF-8 buffer and the byte offset of each, as the raw block methods setSparseBlock, setBlockPacked and setColumnBlockPacked take their text. String n owns bytes textOffsets[n] to textOffsets[n + 1]. setSparseCells, setBlockCells and setColumnBlockCells call it for you.

Declaration

function packTexts(texts: readonly string[]): {
textBuf: Uint8Array;
textOffsets: Uint32Array;
}

Parameters

texts: readonly string[]required

The text of each text cell, in cell order.

Returns

{ textBuf: Uint8Array; textOffsets: Uint32Array; }

The buffer, and one offset per string plus the buffer's length.