Hyperlink
public sealed class Hyperlink
Namespace SharpCell · package SharpCell
A hyperlink on a cell: a web or e-mail address, a file, or a place in the workbook. The cell's value is what Excel shows; the link neither changes it nor applies the Hyperlink cell style.
Constructors
Hyperlink(string, string)
public Hyperlink(string target, string? tooltip = null)
A link to target, with an optional tooltip.
Parameters
target: A web or e-mail address or a file (https://example.com,mailto:a@example.com,report.pdf), or a place in the workbook written as Excel's HYPERLINK function takes it:#Sheet2!A1,#'Q1 Sales'!A1or#MyName.tooltip: Excel's ScreenTip, shown when the pointer rests on the cell; at most 255 characters, or null for none.
Exceptions
ArgumentNullException: The target is null.ArgumentException: The target is empty or only#, or the tooltip is longer than 255 characters.
Properties
IsInWorkbook
public bool IsInWorkbook { get; }
Whether the link goes to a place in this workbook, that is, the target starts with #.
Target
public string Target { get; }
Where the link goes, as given to the constructor.
An empty fragment is dropped when the link is saved: https://example.com/# reads back as https://example.com/.
Tooltip
public string? Tooltip { get; }
The ScreenTip, or null for none.
Methods
Equals(Hyperlink)
public bool Equals(Hyperlink? other)
Whether the other link has the same target and tooltip, compared ordinally.
Equals(object)
public override bool Equals(object? obj)
Whether obj is the same link.
GetHashCode()
public override int GetHashCode()
A hash code consistent with Hyperlink.Equals.
ToString()
public override string ToString()
The target.