Skip to content
Sheetwrite

@sheetwrite/formulas

convertXlsxFormulasfunction

Report a problem

On this page

Convert joined formula sources, separated by cumulative UTF-16 ends (JavaScript string lengths). Return only the changed formulas, and write their input indices to the front of changed_indices, which holds at least one slot per source. Unchanged inputs keep their JavaScript strings. An empty batch has empty text and ends. An end inside a surrogate pair or outside the text fails.

Declaration

function convertXlsxFormulas(
joined: string,
ends: Uint32Array,
exporting: boolean,
changed_indices: Uint32Array,
): string[]

Parameters

joined: stringrequired

Every formula's text, one after another, without separators.

ends: Uint32Arrayrequired

Where each formula ends in joined, as a UTF-16 offset.

exporting: booleanrequired

true to write XLSX spelling (with _xlfn. and _xlpm. prefixes), false to read it.

changed_indices: Uint32Arrayrequired

Receives each changed formula's input index, from the start; needs a slot per formula.

Returns

string[]

The text of each changed formula, in input order; throws when an end splits a surrogate pair or falls outside joined.

Referenced by

Public exports naming convertXlsxFormulas