asposecells.api

Class ExternalLinkCollection

Represents external links collection in a workbook.

Example:

# Open a file with external links
workbook = Workbook("ExternalFormula.xlsx")
# Change external link data source
workbook.getWorksheets().getExternalLinks().get(0).setDataSource("Book2.xlsx")

Property Getters/Setters Summary
methodgetCount()
Gets the number of elements actually contained in the collection.
methodget(index)
Gets the ExternalLink element at the specified index.
 
Method Summary
methodadd(directoryType, fileName, sheetNames)
Add an external link .
methodadd(fileName, sheetNames)
Adds an external link.
methodclear()
Removes all external links.
methodclear(updateReferencesAsLocal)
Removes all external links.
methoditerator()
Get an enumerator that iterates through this collection.
methodremoveAt(index)
Removes the specified external link from the workbook.
methodremoveAt(index, updateReferencesAsLocal)
Removes the specified external link from the workbook.
 

    • Property Getters/Setters Detail

      • getCount : int 

        int getCount()
        
        Gets the number of elements actually contained in the collection.
      • get : ExternalLink 

        ExternalLink get(index)
        
        Gets the ExternalLink element at the specified index.
        Parameters:
        index - The zero based index of the element.
        Returns:
        The element at the specified index.
    • Method Detail

      • add

        int add(fileName, sheetNames)
        Adds an external link.
        Parameters:
        fileName: String - The external file name.
        sheetNames: String[] - All sheet names of the external file.
        Returns:
        The position of the external name in this list.
      • add

        int add(directoryType, fileName, sheetNames)
        Add an external link .
        Parameters:
        directoryType: int - A DirectoryType value. The directory type of the file name.
        fileName: String - the file name.
        sheetNames: String[] - All sheet names of the external file.
        Returns:
        The position of the external name in this list.
      • clear

         clear()
        Removes all external links. When removing external links, all formulas that reference to them will be removed too because the references become invalid.
      • clear

         clear(updateReferencesAsLocal)
        Removes all external links. If references are required to be updated, those references of external links in formulas will be changed to current workbook when it is possible. For example, one cell's original formula is "='externalsource.xlam'!customfunction()", after removing external links, the formula will become "=customfunction()"; When the original formula is "='[externalsource.xlam]Sheet1'!$A$1", according to whether there is one sheet with name "Sheet1" in current workbook: if true, the formula will become "=Sheet1!$A$1"; if false, the formula will become "=#REF!$A$1".
        If references are not required to be updated, all formulas with references to external links will be removed too because those references become invalid.
        Parameters:
        updateReferencesAsLocal: boolean - Whether update all references of external links in formulas to references of current workbook itself.
      • removeAt

         removeAt(index)
        Removes the specified external link from the workbook. When removing the external link, all formulas that reference to it will be removed too because the references become invalid.
        Parameters:
        index: int - the index of the external link to be removed.
      • removeAt

         removeAt(index, updateReferencesAsLocal)
        Removes the specified external link from the workbook.
        Parameters:
        index: int - the index of the external link to be removed.
        updateReferencesAsLocal: boolean - Whether update all references of given external link to reference of current workbook itself. Check clear(boolean) to get more details about this parameter.
      • iterator

        Iterator iterator()
        Get an enumerator that iterates through this collection.
        Returns: