com.aspose.cells

Class NameCollection

  • All Implemented Interfaces:
    java.lang.Iterable
    public class NameCollection 
    extends CollectionBase

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

Property Getters/Setters Summary
intgetCount()
Nameget(int index)
Gets the Name element at the specified index.
Nameget(java.lang.String text)
Gets the Name element with the specified name.
 
Method Summary
intadd(java.lang.Object value)
Reserved for internal use.
intadd(java.lang.String text)
Defines a new name.
voidclear()
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.
booleancontains(java.lang.Object value)
Reserved for internal use.
intindexOf(java.lang.Object value)
Reserved for internal use.
java.util.Iteratoriterator()
voidremove(java.lang.String text)
Remove the name.
voidremove(java.lang.String[] names)
Remove an array of name
voidremoveAt(int index)
Remove the name at the specific index.
voidremoveDuplicateNames()
Remove the duplicate defined names
voidsort()
Sorts defined names.
 

    • Property Getters/Setters Detail

      • getCount

        public int getCount()
        
      • get

        public Name get(int index)
        
        Gets the Name element at the specified index.
        Parameters:
        index - The zero based index of the element.
        Returns:
        The element at the specified index.
      • get

        public Name get(java.lang.String text)
        
        Gets the Name element with the specified name.
        Parameters:
        text - Name text.
        Returns:
        The element with the specified name.
    • Method Detail

      • add

        public int add(java.lang.String text)
        Defines a new name. Name cannot include spaces and cannot look like cell references.
        Parameters:
        text - The text to use as the name.
        Returns:
        Name object index.
      • remove

        public void remove(java.lang.String[] names)
        Remove an array of name
        Parameters:
        names - The names' text.
      • remove

        public void remove(java.lang.String text)
        Remove the name.
        Parameters:
        text - The name text.
      • removeAt

        public void removeAt(int 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.
        Parameters:
        index - index of the Name to be removed.
      • clear

        public void 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

        public void removeDuplicateNames()
        Remove the duplicate defined names
      • sort

        public void 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

        public java.util.Iterator iterator()
      • contains

        public boolean contains(java.lang.Object value)
        Reserved for internal use.
      • add

        public int add(java.lang.Object value)
        Reserved for internal use.
      • indexOf

        public int indexOf(java.lang.Object value)
        Reserved for internal use.