Skip to content
Document Authoring DA  API Docs v2.0.0
npmGitHub

DocAuthSpreadsheetEditorNEW

DocAuthSpreadsheetEditor:

A mounted spreadsheet editor.

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.

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.

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.

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.

number

void


docAuthSystem(): DocAuthSystem

The system this editor was created by.

DocAuthSystem


destroy(): void

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

void