Hosting Controls

Both Word and Excel have host items that function as containers for controls and code. A host item is essentially a proxy object that represents a physical document within either application. These are key to document-level customizations. For Word, we have the Microsoft.Office.Tools.Word.Document object, and for Excel, we have the Microsoft.Office.Tools.Excel.Worksheet object. Within Visual Studio, we build functionality using these host items through the use of designers. Each host item can host both Windows Forms controls and native Office controls.

Note

There is actually a third host item that represents an Excel workbook: Microsoft.Office.Tools.Excel.Workbook. It is a host item for enabling workbook-level customization, ...

Get Microsoft Visual Studio 2015 Unleashed, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.