ExternalLinkCollection

Inheritance: java.lang.Object

All Implemented Interfaces: java.lang.Iterable

public class ExternalLinkCollection implements Iterable

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");

Methods

MethodDescription
add(int directoryType, String fileName, String[] sheetNames)Add an external link .
add(String fileName, String[] sheetNames)Adds an external link.
clear()Removes all external links.
clear(boolean updateReferencesAsLocal)Removes all external links.
equals(Object arg0)
get(int index)Gets the ExternalLink element at the specified index.
getClass()
getCount()Gets the number of elements actually contained in the collection.
hashCode()
iterator()Get an enumerator that iterates through this collection.
notify()
notifyAll()
removeAt(int index)Removes the specified external link from the workbook.
removeAt(int index, boolean updateReferencesAsLocal)Removes the specified external link from the workbook.
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

add(int directoryType, String fileName, String[] sheetNames)

public int add(int directoryType, String fileName, String[] sheetNames)

Add an external link .

Parameters:

ParameterTypeDescription
directoryTypeintDirectoryType. The directory type of the file name.
fileNamejava.lang.Stringthe file name.
sheetNamesjava.lang.String[]All sheet names of the external file.

Returns: int - The position of the external name in this list.

add(String fileName, String[] sheetNames)

public int add(String fileName, String[] sheetNames)

Adds an external link.

Parameters:

ParameterTypeDescription
fileNamejava.lang.StringThe external file name.
sheetNamesjava.lang.String[]All sheet names of the external file.

Returns: int - The position of the external name in this list.

clear()

public void clear()

Removes all external links.

Remarks

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

clear(boolean updateReferencesAsLocal)

public void clear(boolean updateReferencesAsLocal)

Removes all external links.

Remarks

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:

ParameterTypeDescription
updateReferencesAsLocalbooleanWhether update all references of external links in formulas to references of current workbook itself.

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

get(int index)

public ExternalLink get(int index)

Gets the ExternalLink element at the specified index.

Parameters:

ParameterTypeDescription
indexintThe zero based index of the element.

Returns: ExternalLink - The element at the specified index.

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getCount()

public int getCount()

Gets the number of elements actually contained in the collection.

Returns: int

hashCode()

public native int hashCode()

Returns: int

iterator()

public Iterator iterator()

Get an enumerator that iterates through this collection.

Returns: java.util.Iterator -

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

removeAt(int index)

public void removeAt(int index)

Removes the specified external link from the workbook.

Remarks

When removing the external link, all formulas that reference to it will be removed too because the references become invalid.

Parameters:

ParameterTypeDescription
indexintthe index of the external link to be removed.

removeAt(int index, boolean updateReferencesAsLocal)

public void removeAt(int index, boolean updateReferencesAsLocal)

Removes the specified external link from the workbook.

Parameters:

ParameterTypeDescription
indexintthe index of the external link to be removed.
updateReferencesAsLocalbooleanWhether update all references of given external link to reference of current workbook itself. Check clear(boolean) to get more details about this parameter.

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int