Поделиться через


Office UI Customization

You can programmatically customize the user interface (UI) of Microsoft Office applications by using the Office developer tools in Visual Studio. Some UI features, such as the Ribbon and custom task panes, have corresponding APIs and designers in Visual Studio that you can use to customize the features. Other UI features, such as the Backstage view and shortcut menus, do not have APIs or designers in Visual Studio. However, you can still customize these features by using APIs and XML extensibility options provided by Office applications.

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 2007 and Excel 2010

Word 2007 and Word 2010

Custom task panes

Application-level add-ins

Excel 2007 and Excel 2010

InfoPath 2007 and InfoPath 2010

Outlook 2007 and Outlook 2010

PowerPoint 2007 and PowerPoint 2010

Word 2007 and Word 2010

Custom Ribbon UI

Document-level customizations

Application-level add-ins

Excel 2007 and Excel 2010

InfoPath 2010

Outlook 2007 and Outlook 2010

PowerPoint 2007 and PowerPoint 2010

Project 2010

Word 2007 and Word 2010

Visio 2010

Backstage view

Document-level customizations

Application-level add-ins

Excel 2010

InfoPath 2010

Outlook 2010

PowerPoint 2010

Project 2010

Word 2010

Visio 2010

Outlook form regions

Application-level add-ins

Outlook 2007 and Outlook 2010

Controls on documents

Document-level customizations

Application-level add-ins

Excel 2007 and Excel 2010

Word 2007 and Word 2010

Smart tags

Document-level customizations

Application-level add-ins

Excel 2007

Word 2007

Shortcut menus

Document-level customizations

Application-level add-ins

Excel 2007 and Excel 2010

InfoPath 2007 and InfoPath 2010

Outlook 2007 and Outlook 2010

PowerPoint 2007 and PowerPoint 2010

Project 2007 and Project 2010

Word 2007 and Word 2010

Visio 2007 and Visio 2010

Menus and toolbars

Application-level add-ins

InfoPath 2007

Outlook 2007 (Explorer windows)

Project 2007

Visio 2007

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 an application-level 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 toolbar, 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 Overview.

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 Microsoft Office 2010 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 Customizing 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 Creating 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 application-level 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.

Smart Tags

Smart tags are strings of text that have type information attached to them; when a text string that matches the criteria appears in a document, it is recognized and the user is able to perform actions appropriate for that type of string. For example, you could create a smart tag that recognizes stock symbols. When the user types an uppercase string of four letters, a list of stock-related actions, such as looking up a stock price on the Internet, could appear.

You can use the Office development tools in Visual Studio to add smart tags to Word documents and Excel workbooks in document-level customizations. You can also add smart tags to any open document or workbook by using an application-level project.

For more information, see Smart Tags 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.

There are two ways to create shortcut menus:

Toolbars and Menus

Some applications in the 2007 Microsoft Office system use toolbars and menus for the main application UI.

You can add a toolbar to your Office solution to provide the user with easy access to tools and other features. You can customize the toolbar by adding or removing buttons and other controls. You can also customize the location and the docking properties of a toolbar. For more information, see How to: Create Office Toolbars, How to: Add Custom Icons to Toolbar and Menu Items, and How to: Maintain Position Information for Custom Toolbars between Outlook Sessions.

You can add a menu to the menu bar of an Office and create a customized caption for the menu. You can add menu commands to new or existing menus, and you can remove them. For more information, see How to: Add Commands to Shortcut Menus in Excel and How to: Add Custom Menus and Menu Items to Outlook.

See Also

Tasks

How to: Show the Developer Tab on the Ribbon

How to: Show Add-in User Interface Errors

How to: Add Commands to Shortcut Menus in Excel

How to: Add Custom Menus and Menu Items to Outlook

How to: Create Office Toolbars

How to: Add Custom Icons to Toolbar and Menu Items

How to: Maintain Position Information for Custom Toolbars between Outlook Sessions

How to: Interact with Windows Forms

Walkthrough: Collecting Data Using a Windows Form

Concepts

Using WPF Controls in Office Solutions

Other Resources

Ribbon Overview

Actions Pane Overview

Smart Tags Overview

Creating Outlook Form Regions

Custom Task Panes Overview