Class HyperlinkCollection
Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)
Encapsulates a collection of Aspose.Cells.Hyperlink objects.
public class HyperlinkCollection : CollectionBase<hyperlink>, IList<hyperlink>, ICollection<hyperlink>, IEnumerable<hyperlink>, ICollection, IEnumerable
Inheritance
object ← CollectionBase<hyperlink> ← HyperlinkCollection
Implements
IList<hyperlink>, ICollection<hyperlink>, IEnumerable<hyperlink>, ICollection, IEnumerable
Inherited Members
CollectionBase<hyperlink>.BinarySearch(Hyperlink), CollectionBase<hyperlink>.BinarySearch(Hyperlink, IComparer<hyperlink>), CollectionBase<hyperlink>.BinarySearch(int, int, Hyperlink, IComparer<hyperlink>), CollectionBase<hyperlink>.Contains(Hyperlink), CollectionBase<hyperlink>.CopyTo(Hyperlink[]), CollectionBase<hyperlink>.CopyTo(Hyperlink[], int), CollectionBase<hyperlink>.CopyTo(int, Hyperlink[], int, int), CollectionBase<hyperlink>.Exists(Predicate<hyperlink>), CollectionBase<hyperlink>.Find(Predicate<hyperlink>), CollectionBase<hyperlink>.FindAll(Predicate<hyperlink>), CollectionBase<hyperlink>.FindIndex(Predicate<hyperlink>), CollectionBase<hyperlink>.FindIndex(int, Predicate<hyperlink>), CollectionBase<hyperlink>.FindIndex(int, int, Predicate<hyperlink>), CollectionBase<hyperlink>.FindLast(Predicate<hyperlink>), CollectionBase<hyperlink>.FindLastIndex(Predicate<hyperlink>), CollectionBase<hyperlink>.FindLastIndex(int, Predicate<hyperlink>), CollectionBase<hyperlink>.FindLastIndex(int, int, Predicate<hyperlink>), CollectionBase<hyperlink>.IndexOf(Hyperlink), CollectionBase<hyperlink>.IndexOf(Hyperlink, int), CollectionBase<hyperlink>.IndexOf(Hyperlink, int, int), CollectionBase<hyperlink>.LastIndexOf(Hyperlink), CollectionBase<hyperlink>.LastIndexOf(Hyperlink, int), CollectionBase<hyperlink>.LastIndexOf(Hyperlink, int, int), CollectionBase<hyperlink>.GetEnumerator(), CollectionBase<hyperlink>.Clear(), CollectionBase<hyperlink>.RemoveAt(int), CollectionBase<hyperlink>.OnClearComplete(), CollectionBase<hyperlink>.OnClear(), CollectionBase<hyperlink>.Capacity, CollectionBase<hyperlink>.Count, CollectionBase<hyperlink>.InnerList, CollectionBase<hyperlink>.this[int], object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Examples
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[0];
//Get Hyperlinks Collection
HyperlinkCollection hyperlinks = worksheet.Hyperlinks;
//Adding a hyperlink to a URL at "A1" cell
hyperlinks.Add("A1", 1, 1, "http://www.aspose.com");
//Saving the Excel file
workbook.Save("book1.xls");
'Instantiating a Workbook object
Dim workbook As Workbook = New Workbook()
'Obtaining the reference of the newly added worksheet by passing its sheet index
Dim worksheet As Worksheet = workbook.Worksheets(0)
'Get Hyperlinks Collection
Dim hyperlinks As HyperlinkCollection = worksheet.Hyperlinks
'Adding a hyperlink to a URL at "A1" cell
hyperlinks.Add("A1", 1, 1, "http://www.aspose.com")
'Saving the Excel file
workbook.Save("book1.xls")</code></pre>
## Properties
### <a id="Aspose_Cells_HyperlinkCollection_Item_System_Int32_"></a> this\[int\]
Gets the Aspose.Cells.Hyperlink element at the specified index.
```csharp
public Hyperlink this[int index] { get; }
Property Value
Methods
Add(int, int, int, int, string)
Adds a hyperlink to a specified cell or a range of cells.
public int Add(int firstRow, int firstColumn, int totalRows, int totalColumns, string address)
Parameters
firstRow
int
First row of the hyperlink range.
firstColumn
int
First column of the hyperlink range.
totalRows
int
Number of rows in this hyperlink range.
totalColumns
int
Number of columns of this hyperlink range.
address
string
Address of the hyperlink.
Returns
Aspose.Cells.Hyperlink object index.
Examples
[C#]
//Instantiating a Workbook object
Workbook excel = new Workbook();
Worksheet worksheet = excel.Worksheets[0];
worksheet.Hyperlinks.Add("A4", 1, 1, "http://www.aspose.com");
worksheet.Hyperlinks.Add("A5", 1, 1, "c:\\book1.xls");
```
```vb
'Instantiating a Workbook object
Dim excel As Workbook = New Workbook()
Dim worksheet as Worksheet = excel.Worksheets(0)
worksheet.Hyperlinks.Add("A4", 1, 1, "http://www.aspose.com")
worksheet.Hyperlinks.Add("A5", 1, 1, "c:\\book1.xls")
```
### Add\(string, int, int, string\)
Adds a hyperlink to a specified cell or a range of cells.
```csharp
public int Add(string cellName, int totalRows, int totalColumns, string address)
```
#### Parameters
`cellName` [string](https://learn.microsoft.com/dotnet/api/system.string)
Cell name.
`totalRows` [int](https://learn.microsoft.com/dotnet/api/system.int32)
Number of rows in this hyperlink range.
`totalColumns` [int](https://learn.microsoft.com/dotnet/api/system.int32)
Number of columns of this hyperlink range.
`address` [string](https://learn.microsoft.com/dotnet/api/system.string)
Address of the hyperlink.
#### Returns
[int](https://learn.microsoft.com/dotnet/api/system.int32)
Aspose.Cells.Hyperlink object index.
### Add\(string, string, string, string, string\)
Adds a hyperlink to a specified cell or a range of cells.
```csharp
public int Add(string startCellName, string endCellName, string address, string textToDisplay, string screenTip)
```
#### Parameters
`startCellName` [string](https://learn.microsoft.com/dotnet/api/system.string)
The top-left cell of the range.
`endCellName` [string](https://learn.microsoft.com/dotnet/api/system.string)
The bottom-right cell of the range.
`address` [string](https://learn.microsoft.com/dotnet/api/system.string)
Address of the hyperlink.
`textToDisplay` [string](https://learn.microsoft.com/dotnet/api/system.string)
The text to be displayed for the specified hyperlink.
`screenTip` [string](https://learn.microsoft.com/dotnet/api/system.string)
The screenTip text for the specified hyperlink.
#### Returns
[int](https://learn.microsoft.com/dotnet/api/system.int32)
Aspose.Cells.Hyperlink object index.
### Clear\(\)
Clears all hyperlinks.
```csharp
public void Clear()
```
### RemoveAt\(int\)
Remove the hyperlink at the specified index in this collection.
```csharp
public void RemoveAt(int index)
```
#### Parameters
`index` [int](https://learn.microsoft.com/dotnet/api/system.int32)
The zero based index of the element.