Office.Addin interface

Represents add-in level functionality for operating or configuring various aspects of the add-in.

Methods

getStartupBehavior()

Gets the current startup behavior for the add-in.

hide()

Hides the task pane.

onVisibilityModeChanged(listener)

Adds a listener for the onVisibilityModeChanged event.

setStartupBehavior(behavior)

Sets the startup behavior for the add-in for when the document is opened next time.

showAsTaskpane()

Shows the task pane associated with the add-in.

Method Details

getStartupBehavior()

Gets the current startup behavior for the add-in.

getStartupBehavior(): Promise<Office.StartupBehavior>;

Returns

hide()

Hides the task pane.

hide(): Promise<void>;

Returns

Promise<void>

A promise that is resolved when the UI is hidden.

onVisibilityModeChanged(listener)

Adds a listener for the onVisibilityModeChanged event.

onVisibilityModeChanged(
            listener: (message: VisibilityModeChangedMessage) => void,
        ): Promise<() => Promise<void>>;

Parameters

listener

(message: Office.VisibilityModeChangedMessage) => void

The listener function that is called when the event is emitted. This function takes in a message for the receiving component.

Returns

Promise<() => Promise<void>>

A promise that resolves to a function when the listener is added. Calling it removes the listener.

setStartupBehavior(behavior)

Sets the startup behavior for the add-in for when the document is opened next time.

setStartupBehavior(behavior: Office.StartupBehavior): Promise<void>;

Parameters

behavior
Office.StartupBehavior

Specifies startup behavior of the add-in.

Returns

Promise<void>

showAsTaskpane()

Shows the task pane associated with the add-in.

showAsTaskpane(): Promise<void>;

Returns

Promise<void>

A promise that is resolved when the UI is shown.