NameCollection

NameCollection class

Represents a collection of all the Name objects in the spreadsheet.

Properties

NameTypeDescription
CountNumber
Item (int)NameGets the Name element at the specified index.
Item (java.lang.String)NameGets the Name element with the specified name.

Methods

NameDescription
addDefines a new name.

Name cannot include spaces and cannot look like cell references. | | filter | Gets all defined name by scope. | | remove | Remove an array of name | | removeAt | Remove the name at the specific index.

Please make sure that the name is not referred by the other formulas before call | | clear | Remove all defined names which are not referenced by the formulas and data source. If the defined name is referred, we o | | removeDuplicateNames | Remove the duplicate defined names | | sort | Sorts defined names.

If you create a large amount of named ranges in the Excel file, please call this method after all | | iterator | | | get | Reserved for internal use. | | contains | Reserved for internal use. | | indexOf | Reserved for internal use. |

NameCollection.Count property

Type: Number

NameCollection.Item (int) property

Gets the Name element at the specified index.

Type: Name

NameCollection.Item (java.lang.String) property

Gets the Name element with the specified name.

Type: Name

add(text) (1 of 2)

Defines a new name.

Name cannot include spaces and cannot look like cell references.

ParameterTypeDescription
textStringThe text to use as the name.

Returns: Name object index.


add(value) (2 of 2)

Reserved for internal use.

filter(type, sheetIndex)

Gets all defined name by scope.

ParameterTypeDescription
typeNumberA NameScopeType value. The scope type.
sheetIndexNumberThe sheet index. Only effects when scope type is NameScopeType.WORKSHEET

remove(names) (1 of 2)

Remove an array of name

ParameterTypeDescription
namesString[]The names’ text.

remove(text) (2 of 2)

Remove the name.

ParameterTypeDescription
textStringThe name text.

removeAt(index)

Remove the name at the specific index.

Please make sure that the name is not referred by the other formulas before calling the method. And if the name is referred, setting Name.RefersTo as null is better.

ParameterTypeDescription
indexNumberindex of the Name to be removed.

clear()

Remove all defined names which are not referenced by the formulas and data source. If the defined name is referred, we only set Name.ReferTo as null and hide them.

removeDuplicateNames()

Remove the duplicate defined names

sort()

Sorts defined names.

If you create a large amount of named ranges in the Excel file, please call this method after all named ranges are created and before saving

iterator()

get(index)

Reserved for internal use.

contains(value)

Reserved for internal use.

indexOf(value)

Reserved for internal use.