HyperlinkCollection

HyperlinkCollection class

Encapsulates a collection of Hyperlink objects.

class HyperlinkCollection;

Example

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

//Instantiating a Workbook object
var workbook = new Workbook();
//Obtaining the reference of the newly added worksheet by passing its sheet index
var worksheet = workbook.getWorksheets().get(0);

//Get Hyperlinks Collection
var hyperlinks = worksheet.getHyperlinks();
//Adding a hyperlink to a URL at "A1" cell
hyperlinks.add("A1", 1, 1, "http://www.aspose.com");

//Saving the Excel file
workbook.save("output/HyperlinkCollection.xls");

Methods

MethodDescription
get(number)Gets the Hyperlink element at the specified index.
add(number, number, number, number, string)Adds a hyperlink to a specified cell or a range of cells.
add(string, number, number, string)Adds a hyperlink to a specified cell or a range of cells.
add(string, string, string, string, string)Adds a hyperlink to a specified cell or a range of cells.
removeAt(number)Remove the hyperlink at the specified index in this collection.
clear()Clears all hyperlinks.
getCount()Gets the number of elements contained in.
isNull()Checks whether the implementation object is null.

get(number)

Gets the Hyperlink element at the specified index.

get(index: number) : Hyperlink;

Parameters:

ParameterTypeDescription
indexnumberThe zero based index of the element.

Returns

The element at the specified index.

add(number, number, number, number, string)

Adds a hyperlink to a specified cell or a range of cells.

add(firstRow: number, firstColumn: number, totalRows: number, totalColumns: number, address: string) : number;

Parameters:

ParameterTypeDescription
firstRownumberFirst row of the hyperlink range.
firstColumnnumberFirst column of the hyperlink range.
totalRowsnumberNumber of rows in this hyperlink range.
totalColumnsnumberNumber of columns of this hyperlink range.
addressstringAddress of the hyperlink.

Returns

Hyperlink object index.

Example

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

var excel = new Workbook();
var worksheet = excel.getWorksheets().get(0);
worksheet.getHyperlinks().add("A4", 1, 1, "http://www.aspose.com");
worksheet.getHyperlinks().add("A5", 1, 1, "c:\\book1.xls");

add(string, number, number, string)

Adds a hyperlink to a specified cell or a range of cells.

add(cellName: string, totalRows: number, totalColumns: number, address: string) : number;

Parameters:

ParameterTypeDescription
cellNamestringCell name.
totalRowsnumberNumber of rows in this hyperlink range.
totalColumnsnumberNumber of columns of this hyperlink range.
addressstringAddress of the hyperlink.

Returns

Hyperlink object index.

add(string, string, string, string, string)

Adds a hyperlink to a specified cell or a range of cells.

add(startCellName: string, endCellName: string, address: string, textToDisplay: string, screenTip: string) : number;

Parameters:

ParameterTypeDescription
startCellNamestringThe top-left cell of the range.
endCellNamestringThe bottom-right cell of the range.
addressstringAddress of the hyperlink.
textToDisplaystringThe text to be displayed for the specified hyperlink.
screenTipstringThe screenTip text for the specified hyperlink.

Returns

Hyperlink object index.

removeAt(number)

Remove the hyperlink at the specified index in this collection.

removeAt(index: number) : void;

Parameters:

ParameterTypeDescription
indexnumberThe zero based index of the element.

clear()

Clears all hyperlinks.

clear() : void;

getCount()

Gets the number of elements contained in.

getCount() : number;

isNull()

Checks whether the implementation object is null.

isNull() : boolean;