NameCollection

NameCollection class

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

Methods

NameDescription
add(text)Defines a new name. Name cannot include spaces and cannot look like cell references.
add()Reserved for internal use.
clear()Remove all defined names which are not referenced by the formulas and data source. If the defined name is referred, we o
contains()Reserved for internal use.
filter(type, sheetIndex)Gets all defined name by scope.
get(index)Gets the Name element at the specified index.
get(text)Gets the Name element with the specified name.
get()Reserved for internal use.
getCount()
indexOf()Reserved for internal use.
iterator()
remove(names)Remove an array of name
remove(text)Remove the name.
removeAt(index)Remove the name at the specific index. Please make sure that the name is not referred by the other formulas before calli
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 n

add(text)

Defines a new name. Name cannot include spaces and cannot look like cell references.

ParameterTypeDescription
textStringThe text to use as the name.

Returns: Number — Number Name object index.

add()

Reserved for internal use.

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.

contains()

Reserved for internal use.

filter(type, sheetIndex)

Gets all defined name by scope.

ParameterTypeDescription
typeNumberNameScopeType
sheetIndexNumberThe sheet index. Only effects when scope type is

Returns: Array ofName — Array ofName

get(index)

Gets the Name element at the specified index.

ParameterTypeDescription
indexNumberThe zero based index of the element.

Returns: Name — Name The element at the specified index.

get(text)

Gets the Name element with the specified name.

ParameterTypeDescription
textStringName text.

Returns: Name — Name The element with the specified name.

get()

Reserved for internal use.

getCount()

indexOf()

Reserved for internal use.

iterator()

remove(names)

Remove an array of name

ParameterTypeDescription
namesArray of StringThe names’ text.

remove(text)

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.

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