Edit

Share via


Word.TextColumnCollection 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.

A collection of Word.TextColumn objects that represent all the columns of text in the document or a section of the document.

Extends

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

Properties

context

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

items

Gets the loaded child items in this collection.

Methods

add(options)

Returns a TextColumn object that represents a new text column added to a section or document.

getFlowDirection()

Gets the direction in which text flows from one text column to the next.

getHasLineBetween()

Gets whether vertical lines appear between all the columns in the TextColumnCollection object.

getIsEvenlySpaced()

Gets whether text columns are evenly spaced.

getItem(index)

Gets a TextColumn by its index in the collection.

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.

setCount(numColumns)

Arranges text into the specified number of text columns.

setFlowDirection(value)

Sets the direction in which text flows from one text column to the next.

setFlowDirection(value)

Sets the direction in which text flows from one text column to the next.

setHasLineBetween(value)

Sets whether vertical lines appear between all the columns in the TextColumnCollection object.

setIsEvenlySpaced(value)

Sets whether text columns are evenly spaced.

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.TextColumnCollection object is an API object, the toJSON method returns a plain JavaScript object (typed as Word.Interfaces.TextColumnCollectionData) that contains an "items" array with shallow copies of any loaded properties from the collection's items.

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

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

items

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 loaded child items in this collection.

readonly items: Word.TextColumn[];

Property Value

Method Details

add(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.

Returns a TextColumn object that represents a new text column added to a section or document.

add(options?: Word.TextColumnAddOptions): Word.TextColumn;

Parameters

options
Word.TextColumnAddOptions

Optional. Options for configuring the new text column.

Returns

A TextColumn object that represents a new text column added to the document.

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

getFlowDirection()

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 direction in which text flows from one text column to the next.

getFlowDirection(): OfficeExtension.ClientResult<Word.FlowDirection>;

Returns

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

getHasLineBetween()

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 whether vertical lines appear between all the columns in the TextColumnCollection object.

getHasLineBetween(): OfficeExtension.ClientResult<boolean>;

Returns

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

getIsEvenlySpaced()

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 whether text columns are evenly spaced.

getIsEvenlySpaced(): OfficeExtension.ClientResult<boolean>;

Returns

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

getItem(index)

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 a TextColumn by its index in the collection.

getItem(index: number): Word.TextColumn;

Parameters

index

number

A number that identifies the index location of a TextColumn object.

Returns

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.TextColumnCollectionLoadOptions & Word.Interfaces.CollectionLoadOptions): Word.TextColumnCollection;

Parameters

options

Word.Interfaces.TextColumnCollectionLoadOptions & Word.Interfaces.CollectionLoadOptions

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.TextColumnCollection;

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?: OfficeExtension.LoadOption): Word.TextColumnCollection;

Parameters

propertyNamesAndPaths
OfficeExtension.LoadOption

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

setCount(numColumns)

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.

Arranges text into the specified number of text columns.

setCount(numColumns: number): void;

Parameters

numColumns

number

The number of columns the text is to be arranged into.

Returns

void

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

setFlowDirection(value)

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 direction in which text flows from one text column to the next.

setFlowDirection(value: Word.FlowDirection): void;

Parameters

value
Word.FlowDirection

The flow direction to set.

Returns

void

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

setFlowDirection(value)

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 direction in which text flows from one text column to the next.

setFlowDirection(value: "LeftToRight" | "RightToLeft"): void;

Parameters

value

"LeftToRight" | "RightToLeft"

The flow direction to set.

Returns

void

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

setHasLineBetween(value)

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 whether vertical lines appear between all the columns in the TextColumnCollection object.

setHasLineBetween(value: boolean): void;

Parameters

value

boolean

true to show vertical lines between columns.

Returns

void

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

setIsEvenlySpaced(value)

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 whether text columns are evenly spaced.

setIsEvenlySpaced(value: boolean): void;

Parameters

value

boolean

true to evenly space all the text columns in the document.

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.TextColumnCollection object is an API object, the toJSON method returns a plain JavaScript object (typed as Word.Interfaces.TextColumnCollectionData) that contains an "items" array with shallow copies of any loaded properties from the collection's items.

toJSON(): Word.Interfaces.TextColumnCollectionData;

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.TextColumnCollection;

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.TextColumnCollection;

Returns