Class
HyperlinkCollection

Manages hyperlinks attached to cell ranges in a worksheet, tracking links through insert/remove operations.

Definition

Namespace:Telerik.Windows.Documents.Spreadsheet.Model

Assembly:Telerik.Windows.Documents.Spreadsheet.dll

Syntax:

cs-api-definition
public class HyperlinkCollection : CellRangeInsertedOrRemovedAwareCollection<SpreadsheetHyperlink>, IEnumerable<SpreadsheetHyperlink>, IEnumerable

Inheritance: objectCellRangeInsertedOrRemovedAwareCollectionBaseCellRangeInsertedOrRemovedAwareCollection<SpreadsheetHyperlink>HyperlinkCollection

Implements: IEnumerableIEnumerable<SpreadsheetHyperlink>

Inherited Members CellRangeInsertedOrRemovedAwareCollection<SpreadsheetHyperlink>.TranslateRange(CellRange, CellRange)CellRangeInsertedOrRemovedAwareCollection<SpreadsheetHyperlink>.GetEnumerator()CellRangeInsertedOrRemovedAwareCollection<SpreadsheetHyperlink>.CountCellRangeInsertedOrRemovedAwareCollection<SpreadsheetHyperlink>.WorksheetCellRangeInsertedOrRemovedAwareCollection<SpreadsheetHyperlink>.CellRangesCellRangeInsertedOrRemovedAwareCollection<SpreadsheetHyperlink>.ElementsCellRangeInsertedOrRemovedAwareCollectionBase.CanInsertOrRemove(ShiftType, CellRange, CellRange)CellRangeInsertedOrRemovedAwareCollectionBase.ShouldTranslateUpDown(RangeType)CellRangeInsertedOrRemovedAwareCollectionBase.ShouldTranslateLeftRight(RangeType)CellRangeInsertedOrRemovedAwareCollectionBase.TranslateRanges(Dictionary<CellRange, CellRange>)CellRangeInsertedOrRemovedAwareCollectionBase.OnBeforeTranslation(Dictionary<CellRange, CellRange>, CellRange, ShiftType)CellRangeInsertedOrRemovedAwareCollectionBase.OnAfterTranslation(Dictionary<CellRange, CellRange>, CellRange, ShiftType)CellRangeInsertedOrRemovedAwareCollectionBase.Cells

Constructors

HyperlinkCollection(Worksheet)

Initializes a new HyperlinkCollection for the specified worksheet.

Declaration

cs-api-definition
public HyperlinkCollection(Worksheet worksheet)

Parameters

worksheet

Worksheet

The worksheet.

Methods

Add(CellIndex, HyperlinkInfo)

Adds a hyperlink to the specified cell and returns the created hyperlink instance.

Declaration

cs-api-definition
public SpreadsheetHyperlink Add(CellIndex cellIndex, HyperlinkInfo hyperlinkInfo)

Parameters

cellIndex

CellIndex

Index of the cell.

hyperlinkInfo

HyperlinkInfo

The hyperlink info.

Returns

SpreadsheetHyperlink

The new hyperlink.

Add(CellRange, HyperlinkInfo)

Adds a hyperlink to the specified cell range, replacing any existing hyperlink in that exact range, and applies hyperlink styling.

Declaration

cs-api-definition
public SpreadsheetHyperlink Add(CellRange cellRange, HyperlinkInfo hyperlinkInfo)

Parameters

cellRange

CellRange

The cell range.

hyperlinkInfo

HyperlinkInfo

The hyperlink info.

Returns

SpreadsheetHyperlink

The new hyperlink.

Adds the specified element when cellRange is inserted.

Declaration

cs-api-definition
protected override SpreadsheetHyperlink Add(CellRange cellRange, SpreadsheetHyperlink element)

Parameters

cellRange

CellRange

The cell range.

element

SpreadsheetHyperlink

The element.

Returns

SpreadsheetHyperlink

Overrides CellRangeInsertedOrRemovedAwareCollection<SpreadsheetHyperlink>.Add(CellRange, SpreadsheetHyperlink)

Checks whether the specified hyperlink exists in the collection by range equality.

Declaration

cs-api-definition
public bool Contains(SpreadsheetHyperlink hyperlink)

Parameters

hyperlink

SpreadsheetHyperlink

The hyperlink.

Returns

bool

A value indicating whether the collection contains the specified hyperlink.

Finds all hyperlinks whose ranges are fully contained within the specified cell range.

Declaration

cs-api-definition
public IEnumerable<SpreadsheetHyperlink> GetContainingHyperlinks(CellRange cellRange)

Parameters

cellRange

CellRange

The cell range.

Returns

IEnumerable<SpreadsheetHyperlink>

The collection of contained hyperlinks.

Finds all hyperlinks whose ranges are fully contained within any of the specified cell ranges.

Declaration

cs-api-definition
public IEnumerable<SpreadsheetHyperlink> GetContainingHyperlinks(IEnumerable<CellRange> cellRanges)

Parameters

cellRanges

IEnumerable<CellRange>

The cell ranges.

Returns

IEnumerable<SpreadsheetHyperlink>

The collection of contained hyperlinks.

Finds all hyperlinks whose ranges overlap with the specified cell range.

Declaration

cs-api-definition
public IEnumerable<SpreadsheetHyperlink> GetIntersectingHyperlinks(CellRange cellRange)

Parameters

cellRange

CellRange

The cell range.

Returns

IEnumerable<SpreadsheetHyperlink>

The collection of intersecting hyperlinks.

OnChanged()

Called when the collection is changed.

Declaration

cs-api-definition
protected virtual void OnChanged()

Remove(CellRange)

Removes elements when cellRange is removed.

Declaration

cs-api-definition
protected override bool Remove(CellRange cellRange)

Parameters

cellRange

CellRange

The cell range.

Returns

bool

Overrides CellRangeInsertedOrRemovedAwareCollection<SpreadsheetHyperlink>.Remove(CellRange)

Removes the specified hyperlink and reverts its cells to default styling.

Declaration

cs-api-definition
public bool Remove(SpreadsheetHyperlink hyperlink)

Parameters

hyperlink

SpreadsheetHyperlink

The hyperlink.

Returns

bool

The value indicating whether the remove was successful.

Attempts to find any hyperlink intersecting the specified cell, returning the last one if multiple exist.

Declaration

cs-api-definition
public bool TryGetHyperlink(CellIndex cellIndex, out SpreadsheetHyperlink hyperlink)

Parameters

cellIndex

CellIndex

Index of the cell.

hyperlink

SpreadsheetHyperlink

The hyperlink.

Returns

bool

The value indicating whether a hyperlink was found.

Attempts to find any hyperlink intersecting the specified cell range, returning the last one if multiple exist.

Declaration

cs-api-definition
public bool TryGetHyperlink(CellRange cellRange, out SpreadsheetHyperlink hyperlink)

Parameters

cellRange

CellRange

The cell range.

hyperlink

SpreadsheetHyperlink

The hyperlink.

Returns

bool

The value indicating whether a hyperlink was found.

Attempts to find a hyperlink with a range that exactly matches the specified cell range.

Declaration

cs-api-definition
public bool TryGetHyperlinkExact(CellRange cellRange, out SpreadsheetHyperlink hyperlink)

Parameters

cellRange

CellRange

The cell range.

hyperlink

SpreadsheetHyperlink

The hyperlink.

Returns

bool

The value indicating whether a hyperlink was found.

Events

Changed

Raised after a hyperlink is added or removed from the collection.

Declaration

cs-api-definition
public event EventHandler Changed

Event Value

EventHandler