creditcardkrot.blogg.se

How to group objects in microsoft word
How to group objects in microsoft word








You can use the generated host item to add controls to the associated document. In VSTO Add-in projects, you can generate Document host items at run time. For example, to select the first paragraph in the document, use the following code. For more information, see Program document-level customizations.

#How to group objects in microsoft word code#

You can access members of the Document host item by using the Me or this keywords from code in the ThisDocument class, or by using Globals.ThisDocument from code outside the ThisDocument class. When you create a document-level project, you can access Document members by using the generated ThisDocument class in your project.

how to group objects in microsoft word

This type is a host item that gives you access to all features of a Document object, and adds additional events and the ability to add managed controls. The Office development tools in Visual Studio extend the Document object by providing the Document type. It is represented by the ActiveDocument property of the Application object. The document that has the focus is called the active document. When you open a document or create a new document, you create a new Document object, which is added to the Documents collection of the Application object. It represents a document and all of its contents. The Document object is central to programming Word. In document-level projects, you can access the Application object by using the Application property of the ThisDocument class. For more information, see Program VSTO Add-ins. In VSTO Add-in projects, you can access the Application object by using the Application field of the ThisAddIn class. You can use its properties and methods to control the Word environment. Its members usually apply to Word as a whole. The Application object represents the Word application, and is the parent of all of the other objects. For more information, see Automate Word by using extended objects and Host items and host controls overview. Host items and host controls behave like the Word objects they extend, but they also have additional functionality such as data-binding capabilities and extra events. In addition to the Word object model, Office projects in Visual Studio provide host items and host controls that extend some objects in the Word object model. These objects include the following five: The following sections briefly describe the top-level objects and how they interact with each other.

how to group objects in microsoft word

For example, you apply formatting to a Range object but you may want to access the range of the current selection, of a particular paragraph, of a section, or of the entire document. The overlap exists because there are multiple ways you can access the same type of object. Both the Document and Selection objects contain Bookmark and Range objects. For example, the Document and Selection objects are both members of the Application object, but the Document object is also a member of the Selection object. The following illustration shows one view of these objects in the hierarchy of the Word object model.Īt first glance, objects appear to overlap. Each of these objects has many methods and properties that you can access to manipulate and interact with the object. The Application object contains the Document, Selection, Bookmark, and Range objects. This object represents the current instance of Word. At the top of the hierarchy is the Application object. These objects are organized in a hierarchy that closely follows the user interface. Word provides hundreds of objects with which you can interact. For resources where you can learn more about the entire Word object model, see Use the Word object model documentation.įor information about using the Word object model to perform specific tasks, see the following topics: This topic provides a brief overview of the Word object model. For more information, see Features available by Office application and project type. This object model consists of classes and interfaces that are provided in the primary interop assembly for Word, and are defined in the namespace.Īpplies to: The information in this topic applies to document-level projects and VSTO Add-in projects for Word.

how to group objects in microsoft word

When you develop Word solutions in Visual Studio, you interact with the Word object model.








How to group objects in microsoft word