Office.Addin interface

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

Properties

beforeDocumentCloseNotification

Represents a modal notification dialog that can appear when the user attempts to close a document. The document won't close until the user responds.

Methods

getStartupBehavior()

Gets the current startup behavior for the add-in.

hide()

Hides the task pane.

onVisibilityModeChanged(handler)

Adds a handler 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.

Property Details

beforeDocumentCloseNotification

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Represents a modal notification dialog that can appear when the user attempts to close a document. The document won't close until the user responds.

beforeDocumentCloseNotification: BeforeDocumentCloseNotification;

Property Value

Remarks

[ API set: SharedRuntime BETA (PREVIEW ONLY) ]

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(handler)

Adds a handler for the onVisibilityModeChanged event.

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

Parameters

handler

(message: Office.VisibilityModeChangedMessage) => void

The handler 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 handler is added. Calling it removes the handler.

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.