Word.ListFormat class
Represents the list formatting characteristics of a range.
- 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. |
| is |
Indicates whether the |
| is |
Indicates whether the |
| list | Returns a |
| list |
Specifies the list level number for the first paragraph for the |
| list |
Gets the string representation of the list value of the first paragraph in the range for the |
| list |
Gets the list template associated with the |
| list |
Gets the type of the list for the |
| list |
Gets the numeric value of the the first paragraph in the range for the |
Methods
| apply |
Adds bullets and formatting to the paragraphs in the range. |
| apply |
Adds bullets and formatting to the paragraphs in the range. |
| apply |
Applies a list template with a specific level to the paragraphs in the range. |
| apply |
Adds numbering and formatting to the paragraphs in the range. |
| apply |
Adds numbering and formatting to the paragraphs in the range. |
| apply |
Adds outline numbering and formatting to the paragraphs in the range. |
| apply |
Adds outline numbering and formatting to the paragraphs in the range. |
| can |
Determines whether the |
| convert |
Converts numbers in the list to plain text. |
| convert |
Converts numbers in the list to plain text. |
| count |
Counts the numbered items in the list. |
| list |
Indents the list by one level. |
| list |
Outdents the list by one level. |
| 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 |
| remove |
Removes numbering from the list. |
| remove |
Removes numbering from the list. |
| 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. |
| 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
isSingleList
Indicates whether the ListFormat object contains a single list.
readonly isSingleList: boolean;
Property Value
boolean
Remarks
isSingleListTemplate
Indicates whether the ListFormat object contains a single list template.
readonly isSingleListTemplate: boolean;
Property Value
boolean
Remarks
list
Returns a List object that represents the first formatted list contained in the ListFormat object.
readonly list: Word.List;
Property Value
Remarks
listLevelNumber
Specifies the list level number for the first paragraph for the ListFormat object.
listLevelNumber: number;
Property Value
number
Remarks
listString
Gets the string representation of the list value of the first paragraph in the range for the ListFormat object.
readonly listString: string;
Property Value
string
Remarks
listTemplate
Gets the list template associated with the ListFormat object.
readonly listTemplate: Word.ListTemplate;
Property Value
Remarks
listType
Gets the type of the list for the ListFormat object.
readonly listType: Word.ListType | "ListNoNumbering" | "ListListNumOnly" | "ListBullet" | "ListSimpleNumbering" | "ListOutlineNumbering" | "ListMixedNumbering" | "ListPictureBullet";
Property Value
Word.ListType | "ListNoNumbering" | "ListListNumOnly" | "ListBullet" | "ListSimpleNumbering" | "ListOutlineNumbering" | "ListMixedNumbering" | "ListPictureBullet"
Remarks
listValue
Gets the numeric value of the the first paragraph in the range for the ListFormat object.
readonly listValue: number;
Property Value
number
Remarks
Method Details
applyBulletDefault(defaultListBehavior)
Adds bullets and formatting to the paragraphs in the range.
applyBulletDefault(defaultListBehavior: Word.DefaultListBehavior): void;
Parameters
- defaultListBehavior
- Word.DefaultListBehavior
Optional. Specifies the default list behavior. Default is word97.
Returns
void
Remarks
applyBulletDefault(defaultListBehavior)
Adds bullets and formatting to the paragraphs in the range.
applyBulletDefault(defaultListBehavior: "Word97" | "Word2000" | "Word2002"): void;
Parameters
- defaultListBehavior
-
"Word97" | "Word2000" | "Word2002"
Optional. Specifies the default list behavior. Default is word97.
Returns
void
Remarks
applyListTemplateWithLevel(listTemplate, options)
Applies a list template with a specific level to the paragraphs in the range.
applyListTemplateWithLevel(listTemplate: Word.ListTemplate, options?: Word.ListTemplateApplyOptions): void;
Parameters
- listTemplate
- Word.ListTemplate
The list template to apply.
- options
- Word.ListTemplateApplyOptions
Optional. Options for applying the list template, such as whether to continue the previous list or which part of the list to apply the template to.
Returns
void
Remarks
applyNumberDefault(defaultListBehavior)
Adds numbering and formatting to the paragraphs in the range.
applyNumberDefault(defaultListBehavior: Word.DefaultListBehavior): void;
Parameters
- defaultListBehavior
- Word.DefaultListBehavior
Optional. Specifies the default list behavior.
Returns
void
Remarks
applyNumberDefault(defaultListBehavior)
Adds numbering and formatting to the paragraphs in the range.
applyNumberDefault(defaultListBehavior: "Word97" | "Word2000" | "Word2002"): void;
Parameters
- defaultListBehavior
-
"Word97" | "Word2000" | "Word2002"
Optional. Specifies the default list behavior.
Returns
void
Remarks
applyOutlineNumberDefault(defaultListBehavior)
Adds outline numbering and formatting to the paragraphs in the range.
applyOutlineNumberDefault(defaultListBehavior: Word.DefaultListBehavior): void;
Parameters
- defaultListBehavior
- Word.DefaultListBehavior
Optional. Specifies the default list behavior.
Returns
void
Remarks
applyOutlineNumberDefault(defaultListBehavior)
Adds outline numbering and formatting to the paragraphs in the range.
applyOutlineNumberDefault(defaultListBehavior: "Word97" | "Word2000" | "Word2002"): void;
Parameters
- defaultListBehavior
-
"Word97" | "Word2000" | "Word2002"
Optional. Specifies the default list behavior.
Returns
void
Remarks
canContinuePreviousList(listTemplate)
Determines whether the ListFormat object can continue a previous list.
canContinuePreviousList(listTemplate: Word.ListTemplate): OfficeExtension.ClientResult<Word.Continue>;
Parameters
- listTemplate
- Word.ListTemplate
The list template to check.
Returns
A Continue value indicating whether continuation is possible.
Remarks
convertNumbersToText(numberType)
Converts numbers in the list to plain text.
convertNumbersToText(numberType: Word.NumberType): void;
Parameters
- numberType
- Word.NumberType
Optional. The type of number to convert.
Returns
void
Remarks
convertNumbersToText(numberType)
Converts numbers in the list to plain text.
convertNumbersToText(numberType: "Paragraph" | "ListNum" | "AllNumbers"): void;
Parameters
- numberType
-
"Paragraph" | "ListNum" | "AllNumbers"
Optional. The type of number to convert.
Returns
void
Remarks
countNumberedItems(options)
Counts the numbered items in the list.
countNumberedItems(options?: Word.ListFormatCountNumberedItemsOptions): OfficeExtension.ClientResult<number>;
Parameters
Optional. Options for counting numbered items, such as the type of number and the level to count.
Returns
OfficeExtension.ClientResult<number>
The number of items.
Remarks
listIndent()
Indents the list by one level.
listIndent(): void;
Returns
void
Remarks
listOutdent()
Outdents the list by one level.
listOutdent(): void;
Returns
void
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.ListFormatLoadOptions): Word.ListFormat;
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.ListFormat;
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?: {
select?: string;
expand?: string;
}): Word.ListFormat;
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
removeNumbers(numberType)
Removes numbering from the list.
removeNumbers(numberType: Word.NumberType): void;
Parameters
- numberType
- Word.NumberType
Optional. The type of number to remove.
Returns
void
Remarks
removeNumbers(numberType)
Removes numbering from the list.
removeNumbers(numberType: "Paragraph" | "ListNum" | "AllNumbers"): void;
Parameters
- numberType
-
"Paragraph" | "ListNum" | "AllNumbers"
Optional. The type of number to remove.
Returns
void
Remarks
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: Interfaces.ListFormatUpdateData, options?: OfficeExtension.UpdateOptions): void;
Parameters
- properties
- Word.Interfaces.ListFormatUpdateData
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)
Sets multiple properties on the object at the same time, based on an existing loaded object.
set(properties: Word.ListFormat): void;
Parameters
- properties
- Word.ListFormat
Returns
void
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.ListFormat object is an API object, the toJSON method returns a plain JavaScript object (typed as Word.Interfaces.ListFormatData) that contains shallow copies of any loaded child properties from the original object.
toJSON(): Word.Interfaces.ListFormatData;
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.ListFormat;
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.ListFormat;