共用方式為


Office UI customization

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

You can customize the user interface (UI) of Microsoft Office applications by using the Office developer tools in Visual Studio. This topic describes the UI features that you can customize in the following sections:

Comparison of UI Features

The following table compares the main UI features that you can customize in Microsoft Office projects.

Feature Supported project types Supported Microsoft Office applications
Actions pane Document-level customizations Excel

Word
Custom task panes VSTO Add-ins Excel

InfoPath 2013

InfoPath 2010

Outlook

PowerPoint

Word
Custom Ribbon UI Document-level customizations

VSTO Add-ins
Excel

InfoPath 2013

InfoPath 2010

Outlook

PowerPoint

Project

Word

Visio
Backstage view Document-level customizations

VSTO Add-ins
Excel

InfoPath 2013.

InfoPath 2010

Outlook

PowerPoint

Project

Word

Visio
Outlook form regions VSTO Add-ins Outlook
Controls on documents Document-level customizations

VSTO Add-ins
Excel

Word
Shortcut menus Document-level customizations

VSTO Add-ins
Excel

InfoPath 2013

InfoPath 2010

Outlook

PowerPoint

Project

Word

Visio

Excel

Actions panes and custom task panes

Task panes are user interface panels that are typically docked to one side of a window in a Microsoft Office application. Almost all Microsoft Office applications include built-in task panes. An example of a task pane is the Help task pane in Word.

The Office development tools in Visual Studio provide two different ways to customize task panes:

  • You can add an actions pane to a document-level customization. By default, the actions pane is displayed on the right side of the application, to the right of the document. However, the actions pane can also be displayed to the left, top, or bottom of the document.

  • You can add a custom task pane to a VSTO Add-in. Users can dock custom task panes to different sides of the application window, or they can drag custom task panes to any location in the window.

    Actions panes and custom task panes provide functionality by hosting a variety of controls to help users with tasks such as data entry. Compared to a Ribbon group, actions panes and custom task panes provide a much larger area to include text and controls.

    For more information about actions panes, see Actions pane overview. For more information about custom task panes, see Custom task panes.

Custom Ribbon UI

You can customize the Ribbon UI to expose functionality that you add to applications in Office. The Ribbon is a way to organize related commands (in the form of controls) so that they are easier to find. You can create your own Ribbon tabs and groups to give users access to functionality that you provide in your solution. Most of the features that were accessed by using the menus and toolbars in earlier versions of the Microsoft Office system can now be accessed by using the Ribbon.

For more information, see Ribbon overview.

Backstage view

In Office applications, clicking the File tab opens the Backstage view. The Backstage view provides a UI that combines file-level tasks and actions, and replaces similar functionality available from the Microsoft Office button in the 2007 Microsoft Office system. The Backstage view is fully extensible by using XML.

Visual Studio does not provide a designer or APIs for customizing the Backstage view. However, if you add a Ribbon (XML) item to your Office project, you can add XML to the Ribbon XML file to customize the Backstage view. For more information about Ribbon (XML) items, see Ribbon XML.

For more information about customizing the Backstage view, see Introduction to the Office 2010 Backstage view for developers and Customize the Office 2010 Backstage view for developers.

Outlook form regions

Use form regions to add custom functionality to standard Microsoft Office Outlook forms. You can create form regions that extend any existing form with additional fields or controls. If you create a new form region by using the Office development tools in Visual Studio, you can use only Windows Forms controls on the form region. If you import a form region that was designed in Outlook, then you can use only native Outlook controls.

You can create form regions that occupy different areas of the Outlook UI. For example, adjoining form regions are displayed at the bottom of the first page of a form, and each adjoining form region is collapsible. You can also add a separate form region that is displayed as a full additional form page and that can appear on any existing standard form or custom form.

For more information, see Create Outlook form regions.

Controls on documents

You can add a variety of controls to Word documents and Excel worksheets. For example, you might want to add a date picker control to a document so the user can enter dates in a standard format, or put a button on a worksheet to send data to a database.

When you develop document-level projects for Excel or Word, you can use the Visual Studio designer to add controls to the document or workbook in your project at design time, or you can programmatically add controls at run time. When you develop VSTO Add-in projects for Excel or Word, you can programmatically add controls to any open document or workbook at run time.

For more information, see Host items and host controls overview and Windows forms controls on Office documents overview.

Shortcut Menus

A shortcut menu appears when you right-click in a document or an application window. You can set a shortcut menu to appear after an event takes place, such as when a user right-clicks a document, workbook, or host control. You can add a number of different menu commands or controls to a shortcut menu. Create shortcut menus by using XML. If you add a Ribbon (XML) item to your Office project, you can add XML to the Ribbon XML file to create shortcut menus. For more information about using XML to create shortcut menus, see How to: Add commands to shortcut menus.

See also