NameCollection
Source: aspose.
Represents a collection of all the Name objects in the spreadsheet.
Methods
add(text) → Number
Defines a new name. Name cannot include spaces and cannot look like cell references.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
text |
String |
|
The text to use as the name. |
- Returns
-
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) → Array of Name
Gets all defined name by scope.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
type |
Number |
|
NameScopeType |
sheetIndex |
Number |
|
The sheet index. Only effects when scope type is |
- Returns
-
Array of Name
get(index) → Name
Gets the Name element at the specified index.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
index |
Number |
|
The zero based index of the element. |
- Returns
-
Name
The element at the specified index.
get(text) → Name
Gets the Name element with the specified name.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
text |
String |
|
Name text. |
- Returns
-
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
Parameter
Name | Type | Optional | Description |
---|---|---|---|
names |
Array of String |
|
The names' text. |
remove(text)
Remove the name.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
text |
String |
|
The 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.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
index |
Number |
|
index 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