ParagraphCollection Object (JavaScript API for Word)

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

Contains a collection of paragraph objects.

Properties

Property Type Description Req. Set
items Paragraph[] A collection of paragraph objects. Read-only. 1.1

Relationships

None

Methods

Method Return Type Description Req. Set
getFirst() Paragraph Gets the first paragraph in this collection. Throws if the collection is empty. 1.3
getFirstOrNullObject() Paragraph Gets the first paragraph in this collection. Returns a null object if the collection is empty. 1.3
getItem(index: number) Paragraph Gets a paragraph object by its index in the collection. 1.1
getLast() Paragraph Gets the last paragraph in this collection. Throws if the collection is empty. 1.3
getLastOrNullObject() Paragraph Gets the last paragraph in this collection. Returns a null object if the collection is empty. 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

getFirst()

Gets the first paragraph in this collection. Throws if the collection is empty.

Syntax

paragraphCollectionObject.getFirst();

Parameters

None

Returns

Paragraph

getFirstOrNullObject()

Gets the first paragraph in this collection. Returns a null object if the collection is empty.

Syntax

paragraphCollectionObject.getFirstOrNullObject();

Parameters

None

Returns

Paragraph

getItem(index: number)

Gets a paragraph object by its index in the collection.

Syntax

paragraphCollectionObject.getItem(index);

Parameters

Parameter Type Description
index number A number that identifies the index location of a paragraph object.

Returns

Paragraph

getLast()

Gets the last paragraph in this collection. Throws if the collection is empty.

Syntax

paragraphCollectionObject.getLast();

Parameters

None

Returns

Paragraph

getLastOrNullObject()

Gets the last paragraph in this collection. Returns a null object if the collection is empty.

Syntax

paragraphCollectionObject.getLastOrNullObject();

Parameters

None

Returns

Paragraph

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