ExternalLinkCollection

ExternalLinkCollection class

Represents external links collection in a workbook.

class ExternalLinkCollection;

Example

const { Workbook } = require("aspose.cells.node");

//Open a file with external links
var workbook = new Workbook("input/Externlink.xls");
//Change external link data source
workbook.getWorksheets().getExternalLinks().get(0).setDataSource("input/Book1.xls");

Methods

MethodDescription
get(number)Gets the ExternalLink element at the specified index.
getCount()Gets the number of elements actually contained in the collection.
add(string, string[])Adds an external link.
add(DirectoryType, string, string[])Add an external link .
clear()Removes all external links.
clear(boolean)Removes all external links.
removeAt(number)Removes the specified external link from the workbook.
removeAt(number, boolean)Removes the specified external link from the workbook.
getEnumerator()Get an enumerator that iterates through this collection.
isNull()Checks whether the implementation object is null.

get(number)

Gets the ExternalLink element at the specified index.

get(index: number) : ExternalLink;

Parameters:

ParameterTypeDescription
indexnumberThe zero based index of the element.

Returns

The element at the specified index.

getCount()

Gets the number of elements actually contained in the collection.

getCount() : number;

add(string, string[])

Adds an external link.

add(fileName: string, sheetNames: string[]) : number;

Parameters:

ParameterTypeDescription
fileNamestringThe external file name.
sheetNamesstring[]All sheet names of the external file.

Returns

The position of the external name in this list.

add(DirectoryType, string, string[])

Add an external link .

add(directoryType: DirectoryType, fileName: string, sheetNames: string[]) : number;

Parameters:

ParameterTypeDescription
directoryTypeDirectoryTypeThe directory type of the file name.
fileNamestringthe file name.
sheetNamesstring[]All sheet names of the external file.

Returns

The position of the external name in this list.

clear()

Removes all external links.

clear() : void;

Remarks

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

clear(boolean)

Removes all external links.

clear(updateReferencesAsLocal: boolean) : void;

Parameters:

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

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.

removeAt(number)

Removes the specified external link from the workbook.

removeAt(index: number) : void;

Parameters:

ParameterTypeDescription
indexnumberthe index of the external link to be removed.

Remarks

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

removeAt(number, boolean)

Removes the specified external link from the workbook.

removeAt(index: number, updateReferencesAsLocal: boolean) : void;

Parameters:

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

getEnumerator()

Get an enumerator that iterates through this collection.

getEnumerator() : ExternalLinkEnumerator;

Returns

ExternalLinkEnumerator

isNull()

Checks whether the implementation object is null.

isNull() : boolean;