WorkbookExtensions Class
Provides methods you can use to extend Microsoft Office Excel workbooks by generating host items for Microsoft.Office.Interop.Excel.Workbook objects and by testing for the existence of the generated host items.
Inheritance Hierarchy
System.Object
Microsoft.Office.Tools.Excel.Extensions.WorkbookExtensions
Namespace: Microsoft.Office.Tools.Excel.Extensions
Assembly: Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)
Syntax
'Declaration
<ExtensionAttribute> _
Public NotInheritable Class WorkbookExtensions
public static class WorkbookExtensions
Methods
Name | Description | |
---|---|---|
GetVstoObject(_Workbook, ApplicationFactory) | Returns a Microsoft.Office.Tools.Excel.Workbook host item that extends the functionality of the current Microsoft.Office.Interop.Excel.Workbook object in an application-level add-in. Pass the Globals.Factory object in your project to the factory parameter. | |
GetVstoObject(_Workbook, Factory) | Returns a Microsoft.Office.Tools.Excel.Workbook host item that extends the functionality of the current Microsoft.Office.Interop.Excel.Workbook object in a document-level customization. Pass the Globals.Factory object in your project to the factory parameter. | |
HasVstoObject(_Workbook, ApplicationFactory) | Returns a value that indicates whether a Microsoft.Office.Tools.Excel.Workbook host item has been created for the current Microsoft.Office.Interop.Excel.Workbook object in an application-level add-in. Pass the Globals.Factory object in your project to the factory parameter. | |
HasVstoObject(_Workbook, Factory) | Returns a value that indicates whether a Microsoft.Office.Tools.Excel.Workbook host item has been created for the current Microsoft.Office.Interop.Excel.Workbook object in a document-level customization. Pass the Globals.Factory object in your project to the factory parameter. |
Top
Remarks
The WorkbookExtensions class contains extension methods that are designed to be accessed on Microsoft.Office.Interop.Excel.Workbook objects. For more information about extension methods, see Extension Methods (C# Programming Guide) and Extension Methods (Visual Basic).
The extension methods in the WorkbookExtensions class are provided for backward compatibility with Office projects that you retarget from the .NET Framework 3.5 to the .NET Framework 4. In new projects that target the .NET Framework 4, you should call the GetVstoObject and HasVstoObject methods that are provided by the Globals.Factory object in your project. For more information, see Extending Word Documents and Excel Workbooks in Application-Level Add-ins at Run Time and Getting Extended Objects from Native Office Objects in Document-Level Customizations.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also
Reference
Microsoft.Office.Tools.Excel.Extensions Namespace
Other Resources
Extending Word Documents and Excel Workbooks in Application-Level Add-ins at Run Time
Getting Extended Objects from Native Office Objects in Document-Level Customizations