CustomPropertyCollection Object (JavaScript API for Word)

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

Contains the collection of customProperty objects.

Properties

Property Type Description Req. Set
items CustomProperty A collection of customProperty objects. Read-only. 1.3

Relationships

None

Methods

Method Return Type Description Req. Set
add(key: string, value: object) CustomProperty Creates a new or sets an existing custom property. 1.3
deleteAll() void Deletes all custom properties in this collection. 1.3
getCount() int Gets the count of custom properties. 1.3
getItem(key: string) CustomProperty Gets a custom property object by its key, which is case-insensitive. Throws if the custom property does not exist. 1.3
getItemOrNullObject(key: string) CustomProperty Gets a custom property object by its key, which is case-insensitive. Returns a null object if the custom property does not exist. 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

add(key: string, value: object)

Creates a new or sets an existing custom property.

Syntax

customPropertyCollectionObject.add(key, value);

Parameters

Parameter Type Description
key string Required. The custom property's key, which is case-insensitive.
value object Required. The custom property's value.

Returns

CustomProperty

deleteAll()

Deletes all custom properties in this collection.

Syntax

customPropertyCollectionObject.deleteAll();

Parameters

None

Returns

void

getCount()

Gets the count of custom properties.

Syntax

customPropertyCollectionObject.getCount();

Parameters

None

Returns

int

getItem(key: string)

Gets a custom property object by its key, which is case-insensitive. Throws if the custom property does not exist.

Syntax

customPropertyCollectionObject.getItem(key);

Parameters

Parameter Type Description
key string The key that identifies the custom property object.

Returns

CustomProperty

getItemOrNullObject(key: string)

Gets a custom property object by its key, which is case-insensitive. Returns a null object if the custom property does not exist.

Syntax

customPropertyCollectionObject.getItemOrNullObject(key);

Parameters

Parameter Type Description
key string Required. The key that identifies the custom property object.

Returns

CustomProperty

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