Represents external links collection in a workbook.
Example:
//Open a file with external links
Workbook workbook = new Workbook("book1.xls");
//Change external link data source
workbook.getWorksheets().getExternalLinks().get(0).setDataSource("d:\\link.xls");
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
public int add(java.lang.String fileName, java.lang.String[] sheetNames)
Adds an external link.
Parameters:
fileName - The external file name.
sheetNames - All sheet names of the external file.
Returns:
The position of the external name in this list.
add
public int add(int directoryType, java.lang.String fileName, java.lang.String[] sheetNames)
Add an external link .
Parameters:
directoryType - A DirectoryType value. The directory type of the file name.
fileName - the file name.
sheetNames - All sheet names of the external file.
Returns:
The position of the external name in this list.
clear
public void 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
public void clear(boolean updateReferencesAsLocal)
Removes all external links.
If references are required to be updated, references to external links in formulas will be changed to current workbook.
For example, one cell's original formula is "='externalsource.xlam'!customfunction()",
after removing external links, the formula will become "=customfunction()".
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 -
Whether update all references of external links as references of current workbook itself.
removeAt
public void removeAt(int 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 - the index of the external link to be removed.
removeAt
public void removeAt(int index, boolean updateReferencesAsLocal)
Removes the specified external link from the workbook.
If references are required to be updated, references to external links in formulas will be changed to current workbook.
For example, the external link to be removed is "externalsource.xlam" and it defines one custom function "customfunction()",
one cell's original formula is "='externalsource.xlam'!customfunction()",
after removing the formula will become "=customfunction()".
If reference are not required to be updated, all formulas with reference to this external link
will be removed too because those references become invalid.
Parameters:
index - the index of the external link to be removed.
updateReferencesAsLocal -
Whether update all references of given external link to reference of current workbook itself.
iterator
public java.util.Iterator iterator()
Get an enumerator that iterates through this collection.