SettingCollection Object (JavaScript API for Excel)

Represents a collection of key-value pair setting objects that are part of the workbook. The scope is limited to per file and add-in (task-pane or content) combination.

Properties

Property Type Description Req. Set
items Setting[] A collection of setting objects. Read-only. 1.4

See property access examples.

Relationships

None

Events

Event Description Event Argument Req. Set
onSettingsChanged A setting in the collection has changed. SettingsChangedEventArgs 1.4

Methods

Method Return Type Description Req. Set
add(key: string, value: (any)[]) Setting Sets or adds the specified setting to the workbook. 1.4
getCount() int Gets the number of Settings in the collection. 1.4
getItem(key: string) Setting Gets a Setting entry via the key. 1.4
getItemOrNullObject(key: string) Setting Gets a Setting entry via the key. If the Setting does not exist, will return a null object. 1.4

Method Details

add(key: string, value: (any)[])

Sets or adds the specified setting to the workbook.

Syntax

settingCollectionObject.add(key, value);

Parameters

Parameter Type Description
key string The Key of the new setting.
value (any)[] The Value for the new setting.

Returns

Setting

getCount()

Gets the number of Settings in the collection.

Syntax

settingCollectionObject.getCount();

Parameters

None

Returns

int

getItem(key: string)

Gets a Setting entry via the key.

Syntax

settingCollectionObject.getItem(key);

Parameters

Parameter Type Description
key string Key of the setting.

Returns

Setting

getItemOrNullObject(key: string)

Gets a Setting entry via the key. If the Setting does not exist, will return a null object.

Syntax

settingCollectionObject.getItemOrNullObject(key);

Parameters

Parameter Type Description
key string The key of the setting.

Returns

Setting

nbsp;

Returns

Setting