Comparteix a través de


Controls on Office documents

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 use the Office development tools in Visual Studio to add Windows Forms controls and host controls to Word documents and Excel worksheets. Host controls are objects that extend various user interface (UI) objects in the Word and Excel object models.

Applies to: The information in this topic applies to document-level projects and VSTO Add-in projects for Excel and Word. For more information, see Features available by Office application and project type.

When you develop VSTO Add-in projects for Excel or Word, you can programmatically add these controls to any open document or workbook at run time.

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

In this section

Describes the functionality of host items and host controls, including programming against events, binding the controls to data, and how the controls differ from the native objects.

Describes the issues that you might encounter when you use host items and host controls in code.

Provides information about using Windows Forms controls on Excel and Word documents and how they differ from controls on a Windows Form.

Describes how to add Windows Forms controls and host controls to Word and Excel documents, and describes limitations about how these controls persist in the document.

Provides information about different ways to customize the UI of Microsoft Office applications by using Visual Studio.

Describes how you can display data in Word and Excel documents by binding the data to host controls within the document.