Edit

Share via


Office.TaskPane interface

Provides methods to manage the task pane of an add-in.

Remarks

Requirement set: TaskPaneAPI 1.1

Examples

// Adjust the width of the task pane.
const width = 500;
Office.extensionLifeCycle.taskpane.setWidth(width);

Methods

setWidth(width)

Sets the width of the task pane of an add-in in pixels.

Method Details

setWidth(width)

Sets the width of the task pane of an add-in in pixels.

setWidth(width: number): void;

Parameters

width

number

The width of a task pane in pixels. The minimum and maximum constraints vary by platform. In Excel on the web, the width must be between 350 and 500 px (inclusive). In Word on the web, the width must be between 330 and 500 px (inclusive). In Office on Windows, the width must be between 51 px and 50% of the client window.

Returns

void

Remarks

Requirement set: TaskPaneAPI 1.1

Important: The default width of the task pane of an add-in varies depending on the platform.

  • Web (Excel): 350 px

  • Web (Word): 330 px

  • Windows: 51 px

If you pass a width beyond the minimum and maximum constraints, the task pane isn't resized and no error is shown.