Word.TextColumnCollection class
A collection of Word.TextColumn objects that represent all the columns of text in the document or a section of the document.
- Extends
Remarks
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 |
| get |
Gets the direction in which text flows from one text column to the next. |
| get |
Gets whether vertical lines appear between all the columns in the |
| get |
Gets whether text columns are evenly spaced. |
| load(options) | Queues up a command to load the specified properties of the object. You must call |
| load(property |
Queues up a command to load the specified properties of the object. You must call |
| load(property |
Queues up a command to load the specified properties of the object. You must call |
| set |
Arranges text into the specified number of text columns. |
| set |
Sets the direction in which text flows from one text column to the next. |
| set |
Sets the direction in which text flows from one text column to the next. |
| set |
Sets whether vertical lines appear between all the columns in the |
| set |
Sets whether text columns are evenly spaced. |
| toJSON() | Overrides the JavaScript |
| 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 |
| 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 |
Property Details
context
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
Gets the loaded child items in this collection.
readonly items: Word.TextColumn[];
Property Value
Method Details
add(options)
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
getFlowDirection()
Gets the direction in which text flows from one text column to the next.
getFlowDirection(): OfficeExtension.ClientResult<Word.FlowDirection>;
Returns
Remarks
getHasLineBetween()
Gets whether vertical lines appear between all the columns in the TextColumnCollection object.
getHasLineBetween(): OfficeExtension.ClientResult<boolean>;
Returns
OfficeExtension.ClientResult<boolean>
Remarks
getIsEvenlySpaced()
Gets whether text columns are evenly spaced.
getIsEvenlySpaced(): OfficeExtension.ClientResult<boolean>;
Returns
OfficeExtension.ClientResult<boolean>
Remarks
load(options)
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
Provides options for which properties of the object to load.
Returns
load(propertyNames)
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)
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)
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
setFlowDirection(value)
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
setFlowDirection(value)
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
setHasLineBetween(value)
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
setIsEvenlySpaced(value)
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
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.
toJSON(): Word.Interfaces.TextColumnCollectionData;
Returns
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.
track(): Word.TextColumnCollection;
Returns
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.
untrack(): Word.TextColumnCollection;