Edit

Share via


Word.ListFormat 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 list formatting characteristics of a range.

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.

isSingleList

Indicates whether the ListFormat object contains a single list.

isSingleListTemplate

Indicates whether the ListFormat object contains a single list template.

list

Returns a List object that represents the first formatted list contained in the ListFormat object.

listLevelNumber

Specifies the list level number for the first paragraph for the ListFormat object.

listString

Gets the string representation of the list value of the first paragraph in the range for the ListFormat object.

listTemplate

Gets the list template associated with the ListFormat object.

listType

Gets the type of the list for the ListFormat object.

listValue

Gets the numeric value of the the first paragraph in the range for the ListFormat object.

Methods

applyBulletDefault(defaultListBehavior)

Adds bullets and formatting to the paragraphs in the range.

applyBulletDefault(defaultListBehavior)

Adds bullets and formatting to the paragraphs in the range.

applyListTemplateWithLevel(listTemplate, options)

Applies a list template with a specific level to the paragraphs in the range.

applyNumberDefault(defaultListBehavior)

Adds numbering and formatting to the paragraphs in the range.

applyNumberDefault(defaultListBehavior)

Adds numbering and formatting to the paragraphs in the range.

applyOutlineNumberDefault(defaultListBehavior)

Adds outline numbering and formatting to the paragraphs in the range.

applyOutlineNumberDefault(defaultListBehavior)

Adds outline numbering and formatting to the paragraphs in the range.

canContinuePreviousList(listTemplate)

Determines whether the ListFormat object can continue a previous list.

convertNumbersToText(numberType)

Converts numbers in the list to plain text.

convertNumbersToText(numberType)

Converts numbers in the list to plain text.

countNumberedItems(options)

Counts the numbered items in the list.

listIndent()

Indents the list by one level.

listOutdent()

Outdents the list by one level.

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.

removeNumbers(numberType)

Removes numbering from the list.

removeNumbers(numberType)

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

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

isSingleList

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.

Indicates whether the ListFormat object contains a single list.

readonly isSingleList: boolean;

Property Value

boolean

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

isSingleListTemplate

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.

Indicates whether the ListFormat object contains a single list template.

readonly isSingleListTemplate: boolean;

Property Value

boolean

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

list

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 List object that represents the first formatted list contained in the ListFormat object.

readonly list: Word.List;

Property Value

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

listLevelNumber

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 list level number for the first paragraph for the ListFormat object.

listLevelNumber: number;

Property Value

number

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

listString

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 string representation of the list value of the first paragraph in the range for the ListFormat object.

readonly listString: string;

Property Value

string

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

listTemplate

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 list template associated with the ListFormat object.

readonly listTemplate: Word.ListTemplate;

Property Value

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

listType

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 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

[ API set: WordApi BETA (PREVIEW ONLY) ]

listValue

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 numeric value of the the first paragraph in the range for the ListFormat object.

readonly listValue: number;

Property Value

number

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

Method Details

applyBulletDefault(defaultListBehavior)

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.

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 DefaultListBehavior.word97.

Returns

void

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

applyBulletDefault(defaultListBehavior)

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.

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 DefaultListBehavior.word97.

Returns

void

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

applyListTemplateWithLevel(listTemplate, 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.

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

[ API set: WordApi BETA (PREVIEW ONLY) ]

applyNumberDefault(defaultListBehavior)

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.

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

[ API set: WordApi BETA (PREVIEW ONLY) ]

applyNumberDefault(defaultListBehavior)

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.

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

[ API set: WordApi BETA (PREVIEW ONLY) ]

applyOutlineNumberDefault(defaultListBehavior)

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.

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

[ API set: WordApi BETA (PREVIEW ONLY) ]

applyOutlineNumberDefault(defaultListBehavior)

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.

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

[ API set: WordApi BETA (PREVIEW ONLY) ]

canContinuePreviousList(listTemplate)

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.

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

[ API set: WordApi BETA (PREVIEW ONLY) ]

convertNumbersToText(numberType)

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.

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

[ API set: WordApi BETA (PREVIEW ONLY) ]

convertNumbersToText(numberType)

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.

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

[ API set: WordApi BETA (PREVIEW ONLY) ]

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

Counts the numbered items in the list.

countNumberedItems(options?: Word.ListFormatCountNumberedItemsOptions): OfficeExtension.ClientResult<number>;

Parameters

options
Word.ListFormatCountNumberedItemsOptions

Optional. Options for counting numbered items, such as the type of number and the level to count.

Returns

The number of items.

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

listIndent()

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.

Indents the list by one level.

listIndent(): void;

Returns

void

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

listOutdent()

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.

Outdents the list by one level.

listOutdent(): void;

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.ListFormatLoadOptions): Word.ListFormat;

Parameters

options
Word.Interfaces.ListFormatLoadOptions

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

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.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)

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 numbering from the list.

removeNumbers(numberType: Word.NumberType): void;

Parameters

numberType
Word.NumberType

Optional. The type of number to remove.

Returns

void

Remarks

[ API set: WordApi BETA (PREVIEW ONLY) ]

removeNumbers(numberType)

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 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

[ API set: WordApi BETA (PREVIEW ONLY) ]

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.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)

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.ListFormat): void;

Parameters

properties
Word.ListFormat

Returns

void

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

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

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

Returns