Class XlsxHyperlinks
- Namespace
- DocWright.Spreadsheet
- Assembly
- DocWright.Spreadsheet.dll
The hyperlinks of one sheet of an opened workbook (Phase 199): read as the file lists them, added and removed as Excel does, and written the way Excel writes its own.
public sealed class XlsxHyperlinks : IReadOnlyList<XlsxHyperlink>, IReadOnlyCollection<XlsxHyperlink>, IEnumerable<XlsxHyperlink>, IEnumerable
- Inheritance
-
XlsxHyperlinks
- Implements
- Inherited Members
Remarks
Measured with Excel (tools/Probe-ExcelNames.ps1): a link to an address outside the
workbook goes through a relationship of its own, one for each link even when two share an
address; a link to a place in the workbook has none. An address's #fragment is the
place in it (location). A link covers a cell or a range; a merged cell's link covers the
cell or the range it was given. A link added over the same range replaces the one there;
one over part of another's range stands beside it.
As Excel's Insert Link does, adding a link sets the text of its first cell to the text to show; with no text given, an empty cell, or one that still shows the address of the link replaced, shows the address, and a cell with another value keeps it. The look (Excel's Hyperlink style) is the caller's to set.
Edits are held in memory and written into the sheet's part when anything next reads it (an insert, a sort, a copy) or the workbook is saved: adding a link to every row of a long sheet costs one write of the part.
Properties
- Count
Gets the number of hyperlinks.
- this[int]
Gets a hyperlink by its place in the list.
Methods
- 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.
- 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.
- GetEnumerator()
Returns the links, in the order the file lists them.
- Remove(XlsxCellRange)
Removes the links of a range, as Excel's Remove Hyperlinks does: each link whose first cell is in the range, and, when the range is one cell, the link that covers it (measured). The cells keep their text and their format.
- Remove(XlsxHyperlink)
Removes one link: the first the sheet lists over the same range.