Word.ListItem class

Represents the paragraph list item format.

[ API set: WordApi 1.3 ]

Extends

Properties

level

Gets or sets the level of the item in the list.

[ API set: WordApi 1.3 ]

listString

Gets the list item bullet, number, or picture as a string. Read-only.

[ API set: WordApi 1.3 ]

siblingIndex

Gets the list item order number in relation to its siblings. Read-only.

[ API set: WordApi 1.3 ]

Methods

getAncestor(parentOnly)

Gets the list item parent, or the closest ancestor if the parent does not exist. Throws if the list item has no ancestor.

[ API set: WordApi 1.3 ]

getAncestorOrNullObject(parentOnly)

Gets the list item parent, or the closest ancestor if the parent does not exist. Returns a null object if the list item has no ancestor.

[ API set: WordApi 1.3 ]

getDescendants(directChildrenOnly)

Gets all descendant list items of the list item.

[ API set: WordApi 1.3 ]

load(option)

Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.

toJSON()
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 are 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 needed to have added the object to the tracked object collection when the object was first created.

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 will need to call "context.sync()" before the memory release takes effect.

Property Details

level

Gets or sets the level of the item in the list.

[ API set: WordApi 1.3 ]

level: number;

Property Value

number

listString

Gets the list item bullet, number, or picture as a string. Read-only.

[ API set: WordApi 1.3 ]

readonly listString: string;

Property Value

string

siblingIndex

Gets the list item order number in relation to its siblings. Read-only.

[ API set: WordApi 1.3 ]

readonly siblingIndex: number;

Property Value

number

Method Details

getAncestor(parentOnly)

Gets the list item parent, or the closest ancestor if the parent does not exist. Throws if the list item has no ancestor.

[ API set: WordApi 1.3 ]

getAncestor(parentOnly?: boolean): Word.Paragraph;

Parameters

parentOnly
boolean

Optional. Specifies only the list item's parent will be returned. The default is false that specifies to get the lowest ancestor.

Returns

Word.Paragraph

getAncestorOrNullObject(parentOnly)

Gets the list item parent, or the closest ancestor if the parent does not exist. Returns a null object if the list item has no ancestor.

[ API set: WordApi 1.3 ]

getAncestorOrNullObject(parentOnly?: boolean): Word.Paragraph;

Parameters

parentOnly
boolean

Optional. Specifies only the list item's parent will be returned. The default is false that specifies to get the lowest ancestor.

Returns

Word.Paragraph

getDescendants(directChildrenOnly)

Gets all descendant list items of the list item.

[ API set: WordApi 1.3 ]

getDescendants(directChildrenOnly?: boolean): Word.ParagraphCollection;

Parameters

directChildrenOnly
boolean

Optional. Specifies only the list item's direct children will be returned. The default is false that indicates to get all descendant items.

Returns

Word.ParagraphCollection

load(option)

Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties.

load(option?: string | string[]): Word.ListItem;

Parameters

option
string | string[]

A comma-delimited string or an array of strings that specify the properties to load.

Returns

Remarks

In addition to this signature, this method has the following signatures:

load(option?: { select?: string; expand?: string; }): Word.ListItem - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load.

load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Word.ListItem - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items.

toJSON()

toJSON(): Word.Interfaces.ListItemData;

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 are 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 needed to have added the object to the tracked object collection when the object was first created.

track(): Word.ListItem;

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 will need to call "context.sync()" before the memory release takes effect.

untrack(): Word.ListItem;

Returns