NameCollection
NameCollection class
Represents a collection of all the Name objects in the spreadsheet.
Properties
| Name | Type | Description |
|---|---|---|
| Count | int | |
| Item (int) | Name | Gets the Name element at the specified index. |
| Item (java.lang.String) | Name | Gets the Name element with the specified name. |
Methods
| Name | Description |
|---|---|
| add | Defines 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: int
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.
| Parameter | Type | Description |
|---|---|---|
| text | String | The 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.
| Parameter | Type | Description |
|---|---|---|
| type | int | A NameScopeType value. The scope type. |
| sheetIndex | int | The sheet index. Only effects when scope type is NameScopeType.WORKSHEET |
remove(names) (1 of 2)
Remove an array of name
| Parameter | Type | Description |
|---|---|---|
| names | String[] | The names’ text. |
remove(text) (2 of 2)
Remove the name.
| Parameter | Type | 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 | Type | Description |
|---|---|---|
| index | int | index 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.