Class NameCollection

Class NameCollection

Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)

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

public class NameCollection : CollectionBase<name>, IList<name>, ICollection<name>, IEnumerable<name>, ICollection, IEnumerable

Inheritance

objectCollectionBase<name>NameCollection

Implements

IList<name>, ICollection<name>, IEnumerable<name>, ICollection, IEnumerable

Inherited Members

CollectionBase<name>.BinarySearch(Name), CollectionBase<name>.BinarySearch(Name, IComparer<name>), CollectionBase<name>.BinarySearch(int, int, Name, IComparer<name>), CollectionBase<name>.Contains(Name), CollectionBase<name>.CopyTo(Name[]), CollectionBase<name>.CopyTo(Name[], int), CollectionBase<name>.CopyTo(int, Name[], int, int), CollectionBase<name>.Exists(Predicate<name>), CollectionBase<name>.Find(Predicate<name>), CollectionBase<name>.FindAll(Predicate<name>), CollectionBase<name>.FindIndex(Predicate<name>), CollectionBase<name>.FindIndex(int, Predicate<name>), CollectionBase<name>.FindIndex(int, int, Predicate<name>), CollectionBase<name>.FindLast(Predicate<name>), CollectionBase<name>.FindLastIndex(Predicate<name>), CollectionBase<name>.FindLastIndex(int, Predicate<name>), CollectionBase<name>.FindLastIndex(int, int, Predicate<name>), CollectionBase<name>.IndexOf(Name), CollectionBase<name>.IndexOf(Name, int), CollectionBase<name>.IndexOf(Name, int, int), CollectionBase<name>.LastIndexOf(Name), CollectionBase<name>.LastIndexOf(Name, int), CollectionBase<name>.LastIndexOf(Name, int, int), CollectionBase<name>.GetEnumerator(), CollectionBase<name>.Clear(), CollectionBase<name>.RemoveAt(int), CollectionBase<name>.OnClearComplete(), CollectionBase<name>.OnClear(), CollectionBase<name>.Capacity, CollectionBase<name>.Count, CollectionBase<name>.InnerList, CollectionBase<name>.this[int], object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Properties

this[int]

Gets the Aspose.Cells.Name element at the specified index.

public Name this[int index] { get; }

Property Value

Name

this[string]

Gets the Aspose.Cells.Name element with the specified name.

public Name this[string text] { get; }

Property Value

Name

Methods

Add(string)

Defines a new name.

public int Add(string text)

Parameters

text string

The text to use as the name.

Returns

int

Aspose.Cells.Name object index.

Remarks

Name cannot include spaces and cannot look like cell references.

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.

public void Clear()

Filter(NameScopeType, int)

Gets all defined name by scope.

public Name[] Filter(NameScopeType type, int sheetIndex)

Parameters

type NameScopeType

The scope type.

sheetIndex int

The sheet index. Only effects when scope type is Aspose.Cells.NameScopeType.Worksheet

Returns

Name[]

Remove(string[])

Remove an array of name

public void Remove(string[] names)

Parameters

names string[]

The names’ text.

Remove(string)

Remove the name.

public void Remove(string text)

Parameters

text string

The name text.

RemoveAt(int)

Remove the name at the specific index.

public void RemoveAt(int index)

Parameters

index int

index of the Name to be removed.

Remarks

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.

RemoveDuplicateNames()

Remove the duplicate defined names

public void RemoveDuplicateNames()

Sort()

Sorts defined names.

public void Sort()

Remarks

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 </name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name></name>