Hyperlinks超链接
Format Support格式支持 (click to show)
Cell Hyperlinks单元格超链接: XLSX/M, XLSB, BIFF8 XLS, XLML, ODS, HTML
Tooltips工具提示: XLSX/M, XLSB, BIFF8 XLS, XLML
Hyperlinks are stored in the 超链接存储在单元格对象的l
key of cell objects. l
键中。 The 超链接对象的Target
field of the hyperlink object is the target of the link, including the URI fragment. Target
字段是链接的目标,包括URI片段。Tooltips are stored in the 工具提示存储在Tooltip
field and are displayed when hovering over the text.Tooltip
字段中,并在将鼠标悬停在文本上时显示。
For example, the following snippet creates a link from cell 例如,以下代码段创建了从单元格A3
to https://sheetjs.com with the tip "Find us @ SheetJS.com!"
:A3
到https://sheetjs.com提示"Find us @ SheetJS.com!"
:
ws [ "A1" ] . l = { Target : "https://sheetjs.com" , Tooltip : "Find us @ SheetJS.com!" } ;
Note that Excel does not automatically style hyperlinks. 请注意,Excel不会自动设置超链接的样式。They will be displayed using default style. 它们将使用默认样式显示。SheetJS Pro Basic extends this export with support for hyperlink styling.SheetJS Pro Basic扩展了此导出,支持超链接样式。
Remote Links远程链接
HTTP / HTTPS links can be used directly:可以直接使用HTTP/HTTPS链接:
ws [ "A2" ] . l = { Target : "https://docs.sheetjs.com/#hyperlinks" } ;
ws [ "A3" ] . l = { Target : "http://localhost:7262/yes_localhost_works" } ;
Excel also supports Excel还支持带有主题行的mailto
email links with subject line:mailto
电子邮件链接:
ws [ "A4" ] . l = { Target : "mailto:[email protected]" } ;
ws [ "A5" ] . l = { Target : "mailto:[email protected]?subject=Test Subject" } ;
Local Links本地链接
Links to absolute paths should use the 指向绝对路径的链接应使用file://
URI scheme:file://
URI方案:
ws [ "B1" ] . l = { Target : "file:///SheetJS/t.xlsx" } ; /* Link to /SheetJS/t.xlsx */
ws [ "B2" ] . l = { Target : "file:///c:/SheetJS.xlsx" } ; /* Link to c:\SheetJS.xlsx */
Links to relative paths can be specified without a scheme:可以在没有方案的情况下指定指向相对路径的链接:
ws [ "B3" ] . l = { Target : "SheetJS.xlsb" } ; /* Link to SheetJS.xlsb */
ws [ "B4" ] . l = { Target : "../SheetJS.xlsm" } ; /* Link to ../SheetJS.xlsm */
Relative Paths have undefined behavior in the SpreadsheetML 2003 format. 在电子表格ML 2003格式中,相对路径具有未定义的行为。Excel 2019 will treat a Excel 2019将把..\
parent mark as two levels up...\
父标记视为向上两级。
Internal Links内部链接
Links where the target is a cell or range or defined name in the same workbook ("Internal Links") are marked with a leading hash character:目标是同一工作簿中的单元格或区域或定义名称的链接(“内部链接”)用前导哈希字符标记:
ws [ "C1" ] . l = { Target : "#E2" } ; /* Link to cell E2 */
ws [ "C2" ] . l = { Target : "#Sheet2!E2" } ; /* Link to cell E2 in sheet Sheet2 */
ws [ "C3" ] . l = { Target : "#SomeDefinedName" } ; /* Link to Defined Name */
HTML
The HTML DOM parser will process HTML DOM解析器将处理表中的<a>
links in the table:<a>
链接: