AboutSupportDeveloper GuideVersion 1.5.2
OpenFin Excel Integration API Reference
    Preparing search index...

    Interface ExcelWorkbook

    An object that represents an open workbook in Excel.

    interface ExcelWorkbook {
        activate(): Promise<void>;
        addEventListener(
            eventName: string,
            listener: ExcelWorkbookEventListener,
        ): Promise<void>;
        addEventListener(
            eventName: "activate",
            listener: WorkbookActivatedEventListener,
        ): Promise<void>;
        addEventListener(
            eventName: "activateWorksheet",
            listener: WorkbookWorksheetActivatedEventListener,
        ): Promise<void>;
        addEventListener(
            eventName: "addWorksheet",
            listener: WorkbookWorksheetAddedEventListener,
        ): Promise<void>;
        addEventListener(
            eventName: "close",
            listener: WorkbookClosedEventListener,
        ): Promise<void>;
        addEventListener(
            eventName: "deactivate",
            listener: WorkbookDeactivatedEventListener,
        ): Promise<void>;
        addEventListener(
            eventName: "deleteWorksheet",
            listener: WorkbookWorksheetDeletedEventListener,
        ): Promise<void>;
        addWorksheet(): Promise<ExcelWorksheet>;
        calculate(): Promise<void>;
        close(): Promise<void>;
        getActiveWorksheet(): Promise<ExcelWorksheet>;
        getCalculationMode(): Promise<ExcelCalculationMode>;
        getFilePath(): Promise<string>;
        getName(): Promise<string>;
        getWindowBounds(): Promise<WindowBounds>;
        getWorksheetByName(worksheetName: string): Promise<ExcelWorksheet | null>;
        getWorksheets(): Promise<ExcelWorksheet[]>;
        removeEventListener(listener: ExcelWorkbookEventListener): Promise<void>;
        save(): Promise<string>;
        saveAs(filePath: string): Promise<string>;
        setWindowBounds(newWindowBounds: WindowBounds): Promise<void>;
    }
    Index
    • Activates the first window associated with the workbook, bringing it in to focus.

      Activating a workbook deactivates the currently activated workbook.

      Returns Promise<void>

    • Adds a listener for the specified workbook event.

      Parameters

      • eventName: string

        Type of the workbook event to listen for.

      • listener: ExcelWorkbookEventListener

        Function called when the specified event occurs.

      Returns Promise<void>

      AdapterError if an exception is thrown by the adapter process, typically by the Excel PIA.

      EventError if specified event is not supported.

    • Adds a listener that is called when the workbook is activated.

      Parameters

      • eventName: "activate"

        Name of the event fired when the workbook is activated.

      • listener: WorkbookActivatedEventListener

        Function called when the specified event occurs.

      Returns Promise<void>

      AdapterError if an exception is thrown by the adapter process, typically by the Excel PIA.

    • Adds a listener that is called when a worksheet is activated in the workbook.

      Parameters

      • eventName: "activateWorksheet"

        Name of the event fired when a worksheet is activated in the workbook.

      • listener: WorkbookWorksheetActivatedEventListener

        Function called when the specified event occurs.

      Returns Promise<void>

      AdapterError if an exception is thrown by the adapter process, typically by the Excel PIA.

    • Adds a listener that is called when a worksheet is added to the workbook.

      Parameters

      • eventName: "addWorksheet"

        Name of the event fired when a worksheet is added to the workbook.

      • listener: WorkbookWorksheetAddedEventListener

        Function called when the specified event occurs.

      Returns Promise<void>

      AdapterError if an exception is thrown by the adapter process, typically by the Excel PIA.

    • Adds a listener that is called when the workbook is closed.

      Parameters

      • eventName: "close"

        Name of the event fired when the workbook is closed.

      • listener: WorkbookClosedEventListener

        Function called when the specified event occurs.

      Returns Promise<void>

      AdapterError if an exception is thrown by the adapter process, typically by the Excel PIA.

    • Adds a listener that is called when the workbook is deactivated (i.e. another workbook is activated).

      Parameters

      • eventName: "deactivate"

        Name of the event fired when the workbook is deactivated.

      • listener: WorkbookDeactivatedEventListener

        Function called when the specified event occurs.

      Returns Promise<void>

      AdapterError if an exception is thrown by the adapter process, typically by the Excel PIA.

    • Adds a listener that is called when a worksheet is deleted from the workbook.

      Parameters

      • eventName: "deleteWorksheet"

        Name of the event fired when a worksheet is deleted from the workbook.

      • listener: WorkbookWorksheetDeletedEventListener

        Function called when the specified event occurs.

      Returns Promise<void>

      AdapterError if an exception is thrown by the adapter process, typically by the Excel PIA.

    • Adds a new worksheet to the workbook.

      Returns Promise<ExcelWorksheet>

      The worksheet that was created.

      AdapterError if an exception is thrown by the adapter process, typically by the Excel PIA.

    • Triggers calculation for the entire workbook.

      Only necessary when automatic calculation is turned off.

      Returns Promise<void>

      AdapterError if an exception is thrown by the adapter process, typically by the Excel PIA.

    • Closes the workbook.

      If the workbook has any unsaved changes, Excel displays a "Save" prompt before closing the workbook.

      After calling this function do not attempt to use this workbook or any child worksheet objects. Doing so will likely result in an AdapterError since the underlying object/file is no longer available.

      Returns Promise<void>

      AdapterError if an exception is thrown by the adapter process, typically by the Excel PIA.

    • Gets the active worksheet.

      Returns Promise<ExcelWorksheet>

      The active worksheet.

      AdapterError if an exception is thrown by the adapter process, typically by the Excel PIA.

    • Get the current calculation mode which determines when the workbook is re-calculated.

      Returns Promise<ExcelCalculationMode>

      The name of the current calculation mode.

      AdapterError if an exception is thrown by the adapter process, typically by the Excel PIA.

    • Gets the workbook file path.

      Returns Promise<string>

      The workbook file path if saved, otherwise returns null.

      AdapterError if an exception is thrown by the adapter process, typically by the Excel PIA.

    • Gets the workbook name.

      Returns Promise<string>

      The workbook name.

      AdapterError if an exception is thrown by the adapter process, typically by the Excel PIA.

    • Gets the workbook window’s size and position.

      Returns Promise<WindowBounds>

      The workbook window’s height, width and top and left position in points.

      AdapterError if an exception is thrown by the adapter process, typically by the Excel PIA.

    • Gets a worksheet with a given name.

      Parameters

      • worksheetName: string

        The name of the worksheet to get.

      Returns Promise<ExcelWorksheet | null>

      The worksheet matching the provided name, or null if no matching worksheet was found.

      AdapterError if an exception is thrown by the adapter process, typically by the Excel PIA.

    • Gets all worksheets belonging to the workbook.

      Returns Promise<ExcelWorksheet[]>

      All worksheets belonging to the workbook.

      AdapterError if an exception is thrown by the adapter process, typically by the Excel PIA.

    • Removes a previously added listener for the specified workbook event.

      Parameters

      Returns Promise<void>

      AdapterError if an exception is thrown by the adapter process, typically by the Excel PIA.

      EventError if provided listener function does not match any added event listener.

    • Saves the workbook to disk.

      Returns Promise<string>

      The full path the workbook was saved to.

      AdapterError if an exception is thrown by the adapter process, typically by the Excel PIA.

    • Saves the workbook to the file path provided.

      Parameters

      • filePath: string

        Full path (including file name) where the workbook should be saved.

      Returns Promise<string>

      The full path the workbook was saved to.

      AdapterError if an exception is thrown by the adapter process, typically by the Excel PIA.

    • Sets the workbook window’s size and position.

      Parameters

      • newWindowBounds: WindowBounds

        The new height, width and top and left position in points to set for the workbook window.

      Returns Promise<void>

      AdapterError if an exception is thrown by the adapter process, typically by the Excel PIA.