DocumentExtensions Class

 

Provides methods you can use to extend Microsoft Office Word documents by generating host items for Microsoft.Office.Interop.Word.Document objects and by testing for the existence of the generated host items.

Namespace:   Microsoft.Office.Tools.Word.Extensions
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

System.Object
  Microsoft.Office.Tools.Word.Extensions.DocumentExtensions

public static class DocumentExtensions

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticGetVstoObject(_Document, ApplicationFactory)

Returns a Microsoft.Office.Tools.Word.Document host item that extends the functionality of the current Microsoft.Office.Interop.Word.Document object in an application-level add-in. Pass the Globals.Factory object in your project to the factory parameter.

System_CAPS_pubmethodSystem_CAPS_staticGetVstoObject(_Document, Factory)

Returns a Microsoft.Office.Tools.Word.Document host item that extends the functionality of the current Microsoft.Office.Interop.Word.Document object in a document-level customization. Pass the Globals.Factory object in your project to the factory parameter.

System_CAPS_pubmethodSystem_CAPS_staticHasVstoObject(_Document, ApplicationFactory)

Returns a value that indicates whether a Microsoft.Office.Tools.Word.Document host item has been created for the current Microsoft.Office.Interop.Word.Document object in an application-level add-in. Pass the Globals.Factory object in your project to the factory parameter.

System_CAPS_pubmethodSystem_CAPS_staticHasVstoObject(_Document, Factory)

Returns a value that indicates whether a Microsoft.Office.Tools.Word.Document host item has been created for the current Microsoft.Office.Interop.Word.Document object in a document-level customization. Pass the Globals.Factory object in your project to the factory parameter.

The DocumentExtensions class contains extension methods that are designed to be accessed on Microsoft.Office.Interop.Word.Document objects. For more information about extension methods, see Extension Methods (C# Programming Guide) and Extension Methods (Visual Basic).

The extension methods in the DocumentExtensions class are provided for backward compatibility with Office projects that you retarget from the .NET Framework 3.5 to the .NET Framework 4 or the .NET Framework 4.5. In new projects that target the .NET Framework 4 or the .NET Framework 4.5, 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 VSTO Add-ins at Run Time and Programming Document-Level Customizations.

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: