Method Add
- Namespace
- DocWright.Spreadsheet
- Assembly
- DocWright.Spreadsheet.dll
Add(XlsxCellRange, Uri, string?, string?, XlsxHyperlinkOptions?)
Adds a link to an address outside the workbook: a web page, an e-mail address, or a file when the options allow files.
public XlsxHyperlink Add(XlsxCellRange range, Uri address, string? tooltip = null, string? display = null, XlsxHyperlinkOptions? options = null)
Parameters
rangeXlsxCellRangeThe cell or the range the link covers.
addressUriThe address. Its fragment (
#section) is written as the place in it, as Excel writes it.tooltipstringThe tip Excel shows over the link, at most 255 characters; null for none.
displaystringThe text to show, written to the first cell; null to leave a cell with a value as it is.
optionsXlsxHyperlinkOptionsWhat an address may be; null for http, https and mailto.
Returns
- XlsxHyperlink
The link.
Exceptions
- ArgumentNullException
addressis null.- ArgumentException
The address's scheme is not allowed, or the tip or the text cannot be written.
- InvalidOperationException
The sheet is not a worksheet.
- InvalidDocumentException
A part of the workbook is malformed.
Add(XlsxCellRange, string, string?, string?)
Adds a link to a place in the workbook: a cell or a range ('Target Sheet'!B2) or a defined name.
public XlsxHyperlink Add(XlsxCellRange range, string location, string? tooltip = null, string? display = null)
Parameters
rangeXlsxCellRangeThe cell or the range the link covers.
locationstringThe place, as Excel writes it: a reference with its sheet, or a name. It is not checked: Excel takes any.
tooltipstringThe tip Excel shows over the link, at most 255 characters; null for none.
displaystringThe text to show, written to the first cell; null to leave a cell with a value as it is.
Returns
- XlsxHyperlink
The link.
Exceptions
- ArgumentNullException
locationis null.- ArgumentException
The location is empty, or it, the tip or the text cannot be written.
- InvalidOperationException
The sheet is not a worksheet.
- InvalidDocumentException
A part of the workbook is malformed.