Edit

Share via


Word.ListFormat class

Represents the list formatting characteristics of a range.

Extends

Remarks

[ API set: WordApiDesktop 1.3 ]

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

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

[ API set: WordApiDesktop 1.3 ]

isSingleListTemplate

Indicates whether the ListFormat object contains a single list template.

readonly isSingleListTemplate: boolean;

Property Value

boolean

Remarks

[ API set: WordApiDesktop 1.3 ]

list

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

readonly list: Word.List;

Property Value

Remarks

[ API set: WordApiDesktop 1.3 ]

listLevelNumber

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

listLevelNumber: number;

Property Value

number

Remarks

[ API set: WordApiDesktop 1.3 ]

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

[ API set: WordApiDesktop 1.3 ]

listTemplate

Gets the list template associated with the ListFormat object.

readonly listTemplate: Word.ListTemplate;

Property Value

Remarks

[ API set: WordApiDesktop 1.3 ]

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

[ API set: WordApiDesktop 1.3 ]

listValue

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: WordApiDesktop 1.3 ]

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

[ API set: WordApiDesktop 1.3 ]

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

[ API set: WordApiDesktop 1.3 ]

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

[ API set: WordApiDesktop 1.3 ]

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

[ API set: WordApiDesktop 1.3 ]

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

[ API set: WordApiDesktop 1.3 ]

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

[ API set: WordApiDesktop 1.3 ]

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

[ API set: WordApiDesktop 1.3 ]

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

[ API set: WordApiDesktop 1.3 ]

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

[ API set: WordApiDesktop 1.3 ]

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

[ API set: WordApiDesktop 1.3 ]

countNumberedItems(options)

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: WordApiDesktop 1.3 ]

listIndent()

Indents the list by one level.

listIndent(): void;

Returns

void

Remarks

[ API set: WordApiDesktop 1.3 ]

listOutdent()

Outdents the list by one level.

listOutdent(): void;

Returns

void

Remarks

[ API set: WordApiDesktop 1.3 ]

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

options
Word.Interfaces.ListFormatLoadOptions

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

[ API set: WordApiDesktop 1.3 ]

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

[ API set: WordApiDesktop 1.3 ]

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;

Returns