Table of Contents

Method Add

Namespace
DocWright.Spreadsheet
Assembly
DocWright.Spreadsheet.dll

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

range XlsxCellRange

The cell or the range the link covers.

address Uri

The address. Its fragment (#section) is written as the place in it, as Excel writes it.

tooltip string

The tip Excel shows over the link, at most 255 characters; null for none.

display string

The text to show, written to the first cell; null to leave a cell with a value as it is.

options XlsxHyperlinkOptions

What an address may be; null for http, https and mailto.

Returns

XlsxHyperlink

The link.

Exceptions

ArgumentNullException

address is 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.

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

range XlsxCellRange

The cell or the range the link covers.

location string

The place, as Excel writes it: a reference with its sheet, or a name. It is not checked: Excel takes any.

tooltip string

The tip Excel shows over the link, at most 255 characters; null for none.

display string

The 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

location is 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.