BuildingBlock BuildingBlock BuildingBlock Interface

Definition

Represents a building block in a template. A building block is pre-built content, similar to autotext, that may contain text, images, and formatting.

public interface class BuildingBlock
[System.Runtime.InteropServices.Guid("BFD3FC23-F763-4FF8-826E-1AFBF598A4E7")]
public interface BuildingBlock
Public Interface BuildingBlock
Attributes

Remarks

Each BuildingBlock object is a member of the BuildingBlocks and BuildingBlockEntries collections. Building blocks are stored in Microsoft Office Word templates. Therefore, to access the building blocks available for a document, you need to access an attached template. Built-in building blocks are stored in the template named "Building Blocks.dotx".

Note: Use the Item(Object) method of the collection or the BuildingBlocks collection to return an individual building block. Depending on how you access the collection, the collection returned may change. For example, if you access a collection of building blocks with a type of wdTypeAutoText with a category of "General", the returned collection may be different from the collection returned if you access a collection of building blocks with a type of wdTypeAutoText with a category of "Custom". It is also different from the collection returned if you access the collection of building blocks with a type of wdTypeCustomAutoText with a category of "General". Therefore, the first item in a collection accessed from the BuildingBlockEntries collection may be different from the first item in the collection accessed from the BuildingBlocks collection.

To create a new building block, you can use the Add method for either the BuildingBlockEntries collection or the BuildingBlocks collection. However, the recommended way to create a new building block is by using the Add(String, WdBuildingBlockTypes, String, Range, Object, WdDocPartInsertOptions) method for the BuildingBlockEntries collection.

Use the Insert(Range, Object) method to insert a new building block into a document. Use the Delete() method to remove a building block from a template.

Building blocks are organized by category and type. Use the BuildingBlockTypes collection to access individual BuildingBlockType objects. Use the Categories collection to access individual Category objects. Then use the BuildingBlocks propery to access the BuildingBlocks collection for a Category object.

Each building block has properties that contain information that applies uniquely to it, such as Name, Description, Type, and Value.

For more information about building blocks, see Working with Building Blocks

Properties

Application Application Application

Returns an _Application object that represents the Microsoft Word application.

Category Category Category

Returns the category for a building block. Read-only.

Creator Creator Creator

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only.

Description Description Description

Returns or sets the description for a building block. Read/write.

ID ID ID

Returns the internal identification number for a building block. Read-only.

Index Index Index

Returns the position of an item in a collection. Read-only.

InsertOptions InsertOptions InsertOptions

Returns or sets an Integer that represents how to insert the contents of a building block into a document. Read/write.

Name Name Name

Returns or sets the name of a building block. Read/write.

Parent Parent Parent

Returns the parent object of the specified BuildingBlock object.

Type Type Type

Returns the type for a building block. Read-only.

Value Value Value

Returns or sets the contents of a building block. Read/write.

Methods

Delete() Delete() Delete()

Deletes the specified building block.

Insert(Range, Object) Insert(Range, Object) Insert(Range, Object)

Inserts the value of a building block into a document and returns a Range object that represents the contents of the building block within the document.

Applies to