Edit

Share via


Word.BuildingBlockGalleryContentControl class

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Represents the BuildingBlockGalleryContentControl object.

Extends

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

Properties

appearance

Specifies the appearance of the content control.

buildingBlockCategory

Specifies the category for the building block content control.

buildingBlockType

Specifies a BuildingBlockType value that represents the type of building block for the building block content control.

color

Specifies the red-green-blue (RGB) value of the color of the content control. You can provide the value in the '#RRGGBB' format.

context

The request context associated with the object. This connects the add-in's process to the Office host application's process.

id

Gets the identification for the content control.

isTemporary

Specifies whether to remove the content control from the active document when the user edits the contents of the control.

level

Gets the level of the content control—whether the content control surrounds text, paragraphs, table cells, or table rows; or if it is inline.

lockContentControl

Specifies if the content control is locked (can't be deleted). true means that the user can't delete it from the active document, false means it can be deleted.

lockContents

Specifies if the contents of the content control are locked (not editable). true means the user can't edit the contents, false means the contents are editable.

placeholderText

Returns a BuildingBlock object that represents the placeholder text for the content control.

range

Returns a Range object that represents the contents of the content control in the active document.

showingPlaceholderText

Gets if the placeholder text for the content control is being displayed.

tag

Specifies a tag to identify the content control.

title

Specifies the title for the content control.

xmlMapping

Returns an XmlMapping object that represents the mapping of the content control to XML data in the data store of the document.

Methods

copy()

Copies the content control from the active document to the Clipboard.

cut()

Removes the content control from the active document and moves the content control to the Clipboard.

delete(deleteContents)

Deletes the content control and optionally its contents.

load(options)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(propertyNames)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(propertyNamesAndPaths)

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

set(properties, options)

Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type.

set(properties)

Sets multiple properties on the object at the same time, based on an existing loaded object.

setPlaceholderText(options)

Sets the placeholder text that displays in the content control until a user enters their own text.

toJSON()

Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify, in turn, calls the toJSON method of the object that's passed to it.) Whereas the original Word.BuildingBlockGalleryContentControl object is an API object, the toJSON method returns a plain JavaScript object (typed as Word.Interfaces.BuildingBlockGalleryContentControlData) that contains shallow copies of any loaded child properties from the original object.

track()

Track the object for automatic adjustment based on surrounding changes in the document. This call is a shorthand for context.trackedObjects.add(thisObject). If you're using this object across .sync calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you need to add the object to the tracked object collection when the object was first created. If this object is part of a collection, you should also track the parent collection.

untrack()

Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You'll need to call context.sync() before the memory release takes effect.

Property Details

appearance

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Specifies the appearance of the content control.

appearance: Word.ContentControlAppearance | "BoundingBox" | "Tags" | "Hidden";

Property Value

Word.ContentControlAppearance | "BoundingBox" | "Tags" | "Hidden"

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

buildingBlockCategory

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Specifies the category for the building block content control.

buildingBlockCategory: string;

Property Value

string

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

buildingBlockType

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Specifies a BuildingBlockType value that represents the type of building block for the building block content control.

buildingBlockType: Word.BuildingBlockType | "QuickParts" | "CoverPage" | "Equations" | "Footers" | "Headers" | "PageNumber" | "Tables" | "Watermarks" | "AutoText" | "TextBox" | "PageNumberTop" | "PageNumberBottom" | "PageNumberPage" | "TableOfContents" | "CustomQuickParts" | "CustomCoverPage" | "CustomEquations" | "CustomFooters" | "CustomHeaders" | "CustomPageNumber" | "CustomTables" | "CustomWatermarks" | "CustomAutoText" | "CustomTextBox" | "CustomPageNumberTop" | "CustomPageNumberBottom" | "CustomPageNumberPage" | "CustomTableOfContents" | "Custom1" | "Custom2" | "Custom3" | "Custom4" | "Custom5" | "Bibliography" | "CustomBibliography";

Property Value

Word.BuildingBlockType | "QuickParts" | "CoverPage" | "Equations" | "Footers" | "Headers" | "PageNumber" | "Tables" | "Watermarks" | "AutoText" | "TextBox" | "PageNumberTop" | "PageNumberBottom" | "PageNumberPage" | "TableOfContents" | "CustomQuickParts" | "CustomCoverPage" | "CustomEquations" | "CustomFooters" | "CustomHeaders" | "CustomPageNumber" | "CustomTables" | "CustomWatermarks" | "CustomAutoText" | "CustomTextBox" | "CustomPageNumberTop" | "CustomPageNumberBottom" | "CustomPageNumberPage" | "CustomTableOfContents" | "Custom1" | "Custom2" | "Custom3" | "Custom4" | "Custom5" | "Bibliography" | "CustomBibliography"

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

color

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Specifies the red-green-blue (RGB) value of the color of the content control. You can provide the value in the '#RRGGBB' format.

color: string;

Property Value

string

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

context

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

The request context associated with the object. This connects the add-in's process to the Office host application's process.

context: RequestContext;

Property Value

id

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Gets the identification for the content control.

readonly id: string;

Property Value

string

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

isTemporary

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Specifies whether to remove the content control from the active document when the user edits the contents of the control.

isTemporary: boolean;

Property Value

boolean

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

level

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Gets the level of the content control—whether the content control surrounds text, paragraphs, table cells, or table rows; or if it is inline.

readonly level: Word.ContentControlLevel | "Inline" | "Paragraph" | "Row" | "Cell";

Property Value

Word.ContentControlLevel | "Inline" | "Paragraph" | "Row" | "Cell"

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

lockContentControl

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Specifies if the content control is locked (can't be deleted). true means that the user can't delete it from the active document, false means it can be deleted.

lockContentControl: boolean;

Property Value

boolean

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

lockContents

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Specifies if the contents of the content control are locked (not editable). true means the user can't edit the contents, false means the contents are editable.

lockContents: boolean;

Property Value

boolean

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

placeholderText

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Returns a BuildingBlock object that represents the placeholder text for the content control.

readonly placeholderText: Word.BuildingBlock;

Property Value

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

range

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Returns a Range object that represents the contents of the content control in the active document.

readonly range: Word.Range;

Property Value

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

showingPlaceholderText

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Gets if the placeholder text for the content control is being displayed.

readonly showingPlaceholderText: boolean;

Property Value

boolean

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

tag

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Specifies a tag to identify the content control.

tag: string;

Property Value

string

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

title

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Specifies the title for the content control.

title: string;

Property Value

string

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

xmlMapping

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Returns an XmlMapping object that represents the mapping of the content control to XML data in the data store of the document.

readonly xmlMapping: Word.XmlMapping;

Property Value

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

Method Details

copy()

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Copies the content control from the active document to the Clipboard.

copy(): void;

Returns

void

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

cut()

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Removes the content control from the active document and moves the content control to the Clipboard.

cut(): void;

Returns

void

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

delete(deleteContents)

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Deletes the content control and optionally its contents.

delete(deleteContents?: boolean): void;

Parameters

deleteContents

boolean

Optional. Whether to delete the contents inside the control.

Returns

void

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

load(options)

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(options?: Word.Interfaces.BuildingBlockGalleryContentControlLoadOptions): Word.BuildingBlockGalleryContentControl;

Parameters

options
Word.Interfaces.BuildingBlockGalleryContentControlLoadOptions

Provides options for which properties of the object to load.

Returns

load(propertyNames)

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(propertyNames?: string | string[]): Word.BuildingBlockGalleryContentControl;

Parameters

propertyNames

string | string[]

A comma-delimited string or an array of strings that specify the properties to load.

Returns

load(propertyNamesAndPaths)

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Queues up a command to load the specified properties of the object. You must call context.sync() before reading the properties.

load(propertyNamesAndPaths?: {
            select?: string;
            expand?: string;
        }): Word.BuildingBlockGalleryContentControl;

Parameters

propertyNamesAndPaths

{ select?: string; expand?: string; }

propertyNamesAndPaths.select is a comma-delimited string that specifies the properties to load, and propertyNamesAndPaths.expand is a comma-delimited string that specifies the navigation properties to load.

Returns

set(properties, options)

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type.

set(properties: Interfaces.BuildingBlockGalleryContentControlUpdateData, options?: OfficeExtension.UpdateOptions): void;

Parameters

properties
Word.Interfaces.BuildingBlockGalleryContentControlUpdateData

A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called.

options
OfficeExtension.UpdateOptions

Provides an option to suppress errors if the properties object tries to set any read-only properties.

Returns

void

set(properties)

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Sets multiple properties on the object at the same time, based on an existing loaded object.

set(properties: Word.BuildingBlockGalleryContentControl): void;

Parameters

Returns

void

setPlaceholderText(options)

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Sets the placeholder text that displays in the content control until a user enters their own text.

setPlaceholderText(options?: Word.ContentControlPlaceholderOptions): void;

Parameters

options
Word.ContentControlPlaceholderOptions

The options for configuring the content control's placeholder text.

Returns

void

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

toJSON()

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Overrides the JavaScript toJSON() method in order to provide more useful output when an API object is passed to JSON.stringify(). (JSON.stringify, in turn, calls the toJSON method of the object that's passed to it.) Whereas the original Word.BuildingBlockGalleryContentControl object is an API object, the toJSON method returns a plain JavaScript object (typed as Word.Interfaces.BuildingBlockGalleryContentControlData) that contains shallow copies of any loaded child properties from the original object.

toJSON(): Word.Interfaces.BuildingBlockGalleryContentControlData;

Returns

track()

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Track the object for automatic adjustment based on surrounding changes in the document. This call is a shorthand for context.trackedObjects.add(thisObject). If you're using this object across .sync calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you need to add the object to the tracked object collection when the object was first created. If this object is part of a collection, you should also track the parent collection.

track(): Word.BuildingBlockGalleryContentControl;

Returns

untrack()

Note

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You'll need to call context.sync() before the memory release takes effect.

untrack(): Word.BuildingBlockGalleryContentControl;

Returns