Excel Host Items and Host Controls

VSTO enhances a number of objects in the Excel object model, such as the ability to bind data to an object and to expose the object's events. These objects are defined as host items and host controls. Recall that host items are containers for host controls in the same way that a UserForm is a container for an ActiveX control. You add the host controls to the host item.

Excel has three types of host items: Workbook, Worksheet, and Chartsheet. There is one Workbook host item and a separate Worksheet host item for each worksheet in the workbook. These host items wrap the native Excel workbook, worksheet, and chartsheet, which are in the Microsoft.Office.Interop.Excel namespace.

As we did with Microsoft.Office.Interop.Word, here we refer to objects in the Microsoft.Office.Interop.Excel namespace as Interop objects. The host items and host controls are in the Microsoft.Office.Tools.Excel namespace, and we sometimes refer to objects in this namespace as VSTO objects. Host items and host controls wrap the native Office objects and have the same functionality as the underlying Interop objects, but they have additional functionality such as enabling data binding and exposing events.

0 0

Post a comment