EditorHandle
What a host controls an editor through, whichever way it shows it: with
Properties
Section titled “Properties”Methods
Section titled “Methods”destroy()
Section titled “destroy()”destroy(): void;Stops the editor’s worker; mountWorkbookEditor’s handle unmounts the editor as well.
Returns
Section titled “Returns”void
downloadCopy()
Section titled “downloadCopy()”downloadCopy(): Promise<void>;Downloads a copy as .xlsx without saving it to the host.
Returns
Section titled “Returns”Promise<void>
downloadCsv()
Section titled “downloadCsv()”downloadCsv(options?): Promise<void>;Downloads the sheet shown, and only that sheet, as a CSV file (UTF-8 with
a byte order mark), as the toolbar’s CSV button does. Values that would run
as formulas in a spreadsheet app are escaped unless escapeFormulas is false.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
CsvOptions |
Returns
Section titled “Returns”Promise<void>
getCsv()
Section titled “getCsv()”getCsv(options?): Promise<string | undefined>;The sheet shown as CSV text, as downloadCsv writes it but without the byte order mark; undefined when it isn’t a worksheet.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
CsvOptions |
Returns
Section titled “Returns”Promise<string | undefined>
getWorkbook()
Section titled “getWorkbook()”getWorkbook(): Promise< | SavedWorkbook| undefined>;The workbook as it is now, as onSave would receive it, without save checks or onSave.
Returns
Section titled “Returns”Promise<
| SavedWorkbook
| undefined>
goTo()
Section titled “goTo()”goTo(ref): void;Selects a cell or range, such as “B4” or “Prices!A1:C3”, or the range a defined name refers to, and shows it.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
ref |
string |
Returns
Section titled “Returns”void
open()
Section titled “open()”open(bytes, fileName): Promise<boolean>;Opens a workbook from its bytes, or a CSV file (.csv, .tsv or .txt, by its name) as a workbook of one sheet. Resolves true once it is open, and false when the user chose to keep the workbook already open, with its unsaved changes. Rejects, saying why, when the file can’t be opened; the editor shows the reason too. The bytes are copied, so the caller’s stay usable.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
bytes |
ArrayBuffer | Uint8Array<ArrayBufferLike> |
fileName |
string |
Returns
Section titled “Returns”Promise<boolean>
registerSchema()
Section titled “registerSchema()”registerSchema(schema): void;Adds or replaces a schema and re-checks the open workbook.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
schema |
WorkbookSchema |
Returns
Section titled “Returns”void
removeSchema()
Section titled “removeSchema()”removeSchema(id): void;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
id |
string |
Returns
Section titled “Returns”void
save()
Section titled “save()”save(): Promise<SaveResult>;Runs the same save as the Save button (schema checks, then onSave or a download), resolving with what happened.
Returns
Section titled “Returns”Promise<SaveResult>
setCustomLists()
Section titled “setCustomLists()”setCustomLists(lists): void;Changes the lists that filling continues, as the customLists option gives them.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
lists |
string[][] | undefined |
Returns
Section titled “Returns”void
setLanguage()
Section titled “setLanguage()”setLanguage(language): void;Changes the language of the editor’s text while it is open.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
language |
string |
Returns
Section titled “Returns”void
setTheme()
Section titled “setTheme()”setTheme(theme): void;Changes the theme tokens while the editor is open.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
theme |
| Partial<Record< | "warning" | "text" | "colorScheme" | "accent" | "accentStrong" | "accentSoft" | "accentBorder" | "accentTint" | "onAccent" | "surface" | "surfaceAlt" | "surfaceSunken" | "backdrop" | "focusRing" | "textMuted" | "textSubtle" | "border" | "borderStrong" | "neutral" | "success" | "successSoft" | "successBorder" | "successText" | "warningSoft" | "warningBorder" | "warningText" | "warningAccent" | "danger" | "dangerSoft" | "dangerBorder" | "onDanger" | "infoSoft" | "infoText" | "infoAccent" | "infoBannerBg" | "infoBannerBorder" | "infoBannerText" | "fieldSoft" | "fieldText" | "noteSoft" | "noteText" | "noteBorder" | "noteTipBg" | "noteTipBorder" | "placeholderBg" | "placeholderBorder" | "placeholderText" | "placeholderTextMuted" | "dropzoneBorder" | "dropzoneHoverBg" | "gridBg" | "gridText" | "gridTextOnFill" | "gridLine" | "gridBorderAuto" | "gridFreezeLine" | "gridHeaderBg" | "gridHeaderText" | "gridHeaderLine" | "gridHeaderHoverBg" | "gridHeaderSelectedBg" | "gridHeaderSelectedText" | "gridRowHeaderText" | "gridTextMuted" | "gridTextLight" | "gridBgAlt" | "gridCutFill" | "gridSelection" | "gridSelectionFill" | "gridEditedFill" | "gridEditedMark" | "gridLockedFill" | "gridLabelFill" | "gridErrorMark" | "gridWarningMark" | "gridPendingMark" | "gridNoteMark" | "gridStaleMark" | "gridUnsupportedMark" | "gridSpillLine" | "gridDropdownArrow" | "gridLink" | "gridFont" | "gridHeaderFont" | "gridHeaderFontSize" | "gridHeaderFontWeight" | "formulaRef1" | "formulaRef2" | "formulaRef3" | "formulaRef4" | "formulaRef5" | "formulaRef6" | "formulaRef7" | "chartColors" | "font" | "fontMono" | "fontSize" | "fontSizeXs" | "fontSizeSm" | "fontSizeMd" | "fontSizeLg" | "fontSizeXl" | "iconStrokeWidth" | "radius" | "radiusSm" | "radiusLg" | "shadow" | "shadowSm", string>> | undefined |
Returns
Section titled “Returns”void
setUser()
Section titled “setUser()”setUser(user): void;Changes the name recorded against each action in the change history.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
user |
string | undefined |
Returns
Section titled “Returns”void
subscribe()
Section titled “subscribe()”subscribe(listener): () => void;Calls listener whenever the editor’s state changes; returns an unsubscribe function.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
listener |
() => void |
Returns
Section titled “Returns”() => void