ListItem Object (JavaScript API for Word)

Word 2016, Word for iPad, Word for Mac, Word Online

Represents the paragraph list item format.

Properties

Property Type Description Req. Set
level int Gets or sets the level of the item in the list. 1.3
listString string Gets the list item bullet, number or picture as a string. Read-only. 1.3
siblingIndex int Gets the list item order number in relation to its siblings. Read-only. 1.3

See property access examples.

Relationships

None

Methods

Method Return Type Description Req. Set
getAncestor(parentOnly: bool) Paragraph Gets the list item parent, or the closest ancestor if the parent does not exist. Throws if the list item has no ancester. 1.3
getAncestorOrNullObject(parentOnly: bool) Paragraph 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 ancester. 1.3
getDescendants(directChildrenOnly: bool) ParagraphCollection Gets all descendant list items of the list item. 1.3
load(param: object) void Fills the proxy object created in JavaScript layer with property and object values specified in the parameter. 1.1

Method Details

getAncestor(parentOnly: bool)

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

Syntax

listItemObject.getAncestor(parentOnly);

Parameters

Parameter Type Description
parentOnly bool Optional. Optional. Specified only the list item's parent will be returned. The default is false that specifies to get the lowest ancestor.

Returns

Paragraph

getAncestorOrNullObject(parentOnly: bool)

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

Syntax

listItemObject.getAncestorOrNullObject(parentOnly);

Parameters

Parameter Type Description
parentOnly bool Optional. Optional. Specified only the list item's parent will be returned. The default is false that specifies to get the lowest ancestor.

Returns

Paragraph

getDescendants(directChildrenOnly: bool)

Gets all descendant list items of the list item.

Syntax

listItemObject.getDescendants(directChildrenOnly);

Parameters

Parameter Type Description
directChildrenOnly bool Optional. Optional. Specified only the list item's direct children will be returned. The default is false that indicates to get all descendant items.

Returns

ParagraphCollection

load(param: object)

Fills the proxy object created in JavaScript layer with property and object values specified in the parameter.

Syntax

object.load(param);

Parameters

Parameter Type Description
param object Optional. Accepts parameter and relationship names as delimited string or an array. Or, provide loadOption object.

Returns

void