Skip to content
Document Authoring DA  API Docs v1.22.2
npmGitHub

DocAuthSpreadsheetEditor

DocAuthSpreadsheetEditor:

A mounted spreadsheet editor.

Experimental: the spreadsheet API may change or be removed in any release, including minor and patch releases.

Like DocAuthEditor, it can be created first and given a spreadsheet to show afterwards.

// The two-phase shape: on screen immediately, filled when the file has been read
const editor = await system.createSpreadsheetEditor(target);
editor.setCurrentSpreadsheet(await system.importSpreadsheet(file));
// Tear down when the view goes away; the system stays alive for the next editor
editor.destroy();

setCurrentSpreadsheet(spreadsheet): void

Shows a spreadsheet, replacing whatever was showing before.

Experimental: the spreadsheet API may change or be removed in any release, including minor and patch releases.

It must have come from the same system this editor did. The counterpart of DocAuthEditor.setCurrentDocument.

DocAuthSpreadsheet

void

// Swap the open file; the same editor object keeps working
editor.setCurrentSpreadsheet(await system.importSpreadsheet(nextFile));

currentSpreadsheet(): DocAuthSpreadsheet

The spreadsheet showing now.

Experimental: the spreadsheet API may change or be removed in any release, including minor and patch releases.

Never null: an editor created without one opens on a blank spreadsheet.

DocAuthSpreadsheet

// Export whatever is showing — no null check needed
downloadButton.onclick = async () => {
const xlsx = await editor.currentSpreadsheet().export({ format: 'xlsx' });
// ... hand it to the user ...
};

activeSheet(): number

Which sheet is showing, as a 0-based index. Right after DocAuthSpreadsheetEditor.setActiveSheet it already names the requested sheet, before the switch is drawn.

Experimental: the spreadsheet API may change or be removed in any release, including minor and patch releases.

number

// Export the sheet the user is looking at
const pdf = await editor.currentSpreadsheet().export({ format: 'pdf', sheet: editor.activeSheet() });

setActiveSheet(index): void

Shows the sheet at a 0-based index. An index with no sheet, or a hidden sheet, leaves the editor where it is.

Experimental: the spreadsheet API may change or be removed in any release, including minor and patch releases.

number

void


docAuthSystem(): DocAuthSystem

The system this editor was created by.

Experimental: the spreadsheet API may change or be removed in any release, including minor and patch releases.

DocAuthSystem


destroy(): void

Removes every element and releases every listener. Calling it twice is harmless. This does not release the DocAuthSystem.

Experimental: the spreadsheet API may change or be removed in any release, including minor and patch releases.

void