SpreadsheetWidget

Represents the SpreadsheetWidget, holding the core functionality of the Spreadsheet.

NameTypeDefaultDescription

view

View

Returns the View object of the Spreadsheet.

workbook

Workbook

Returns the Workbook object of the Spreadsheet.

Constructors

SpreadsheetWidget

(element: HTMLElement, options: SpreadsheetOptions)

Parameters

element

HTMLElement

options

SpreadsheetOptions

Methods

activeSheet

Gets or sets the active sheet.

Parameters

sheet?

Sheet

Returns

void | Sheet

executeCommand

Executes the passed command against the selected cell/range.

Parameters

options

any

An object containing the command name and the required by it options.

fromFile

Clears the Spreadsheet and populates it with data from the specified Excel (.xlsx) file.

Parameters

file

Blob | File

fromJSON

Loads the workbook data from an object with the format that is defined in the configuration.

Note: All existing sheets and their data will be lost.

Parameters

json

DocumentDescriptor

The object from where data will be loaded. This has to be the deserialized object, not the JSON string.

refresh

Re-renders all data in the Spreadsheet.

saveAsExcel

Initiates the Excel export. Also fires the excelExport event.

Note: Calling this method may trigger the built-in popup blocker of the browser. To avoid that, always call it as a response to an end-user action, for example, a button click.

Parameters

options

any

Returns

Promise<undefined>

saveJSON

Serializes the workbook. This method does not return the JSON, but a Promise object which will yield the JSON data when it is available. The method is functionally similar to toJSON, but it is also able to save the embedded images (this is the reason why it must be asynchronous).

Returns

Promise<DocumentDescriptor>

sheets

Returns an array with the sheets in the workbook.

Returns

Sheet[]

toJSON

Serializes the workbook.

Returns

DocumentDescriptor