

- #Inserting a word color theme into publisher how to
- #Inserting a word color theme into publisher code
' Set the template to store the building block
#Inserting a word color theme into publisher code
The following code example collapses the current selection, creates a range and specifies the text for the range, and then adds the selection as a custom building block to the collection of building block entries in the template attached to the current document. Therefore, the preferred way to add new building blocks programmatically is to use the Add method for the BuildingBlockEntries collection. The BuildingBlocksEntries collection contains all the building blocks for a template. As explained in the table of objects, the BuildingBlocks collection is a collection of building blocks for a specific type and category. You can also use the Add method for the BuildingBlocks collection however, this method may raise a run-time error if there are currently no building blocks for the specified type or category. Creating a custom building blockĬreating a custom building block is as simple as using the Add method for the BuildingBlockEntries collection. You can find additional code examples in the object topics and in many of the member topics.
#Inserting a word color theme into publisher how to
The following sections provide simple examples of how to do specific tasks using the building block objects. There are several examples in the following sections that show you how to use the building block objects to work with building blocks programmatically. For example, you can use a building block content control to filter the types of building blocks that a user sees, which means that the user cannot insert a building block into a document that is not allowed at a specific place in the document. Plus, you can use building blocks with content controls to give you even greater control over which building blocks users can insert into their documents. You can also watch for when users insert new building blocks into a document by using the BuildingBlockInsert event. You can create new building blocks, delete building blocks, and manage building blocks programmatically. However, building block are also programmable. The incredible flexibility that building blocks provide help you to create custom solutions without writing code. For example, you can have a building block named "Title" that has a type of wdTypeBibliography and a category of "Book Titles" and another building block named "Title" that has a type of wdTypeBibliography and a category of "Movie Titles" and then you can have yet another building block named "Title" that has a type of wdTypeCustomHeaders and a category of "Book Titles" and so on. Types and categories are explained later in this topic.īecause you can organize building blocks into types and categories, building blocks can be incredibly flexible. A category can be any string that you define. However, you are not limited to just the categories that are included in these templates.
:max_bytes(150000):strip_icc()/010-eyedropper-sample-color-tool-microsoft-publisher-1078816-064f605213a049bbb9fd1d20bbc1c5c5.jpg)
By default, the templates that are included with Word have building block categories like "General" and "Built-In". These types help you to define and organize your building blocks and, although you cannot create additional building block types, you can create an unlimited number of categories for each type.Ĭategories are composed of an unlimited number of strings that you can define to organize your custom building blocks. There are 35 different WdBuildingBlockTypes constants. Although there are a limited number of these constants, that number is not small. Building block types are composed of a limited number of WdBuildingBlockTypes constants. NameĪ collection of building block entries in a template that are of the same type and category.Ī collection of all the building blocks in a template.Ī collection of building block categories.īuilding blocks are organized by type and category.

The new objects and collections are listed in the following table. These enable you to create an organizational structure that works for your specific needs and to modify the structure for a specific solution. The building blocks object model includes three new objects and four new collections. When used together with content controls, building blocks can enable you to develop powerful solutions quickly and easily. A custom building block helps users insert rich content anywhere in a document by using a formatted drop-down list. However, with building blocks, you can organize entries in a way that enables you to determine how a user uses them. Introduced in Word 2007, building blocks are similar to autotext entries in previous versions.
