简体   繁体   English

如何使用JS-XLSX创建内部链接

[英]How to create internal links with JS-XLSX

I'm trying to generate an XLSX Excel document with JS-XLSX and I can't find a way to create the equivalent of an internal link. 我正在尝试使用JS-XLSX生成XLSX Excel文档,但我找不到创建等效内部链接的方法。

I have this summary page in which I'd like to present clickable links pointing to other sheets. 我有这个摘要页面,我想在其中提供指向其他工作表的可点击链接。

在此输入图像描述

I've tried many combination of cell = {l: {Target: "..", Rel: {Target: "...", Type:"Internal"}}} but it doesn't work. 我尝试了很多cell = {l: {Target: "..", Rel: {Target: "...", Type:"Internal"}}}但它不起作用。 It always ends up as an external hyperlink in the generated document. 它始终以生成的文档中的外部超链接结束。

I would accept an XLSX-specific solution. 我会接受特定于XLSX的解决方案。

I'm using JS-XLSX 0.10.4. 我正在使用JS-XLSX 0.10.4。

You can use the below command to make the hyper link. 您可以使用以下命令建立超链接。

cell.l = { Target:"#'" + cell.v + "'!A1", Tooltip:cell.v }

This will anyway add the link, however, this will not format the cell as the hyper link cell. 无论如何,这将添加链接,但是,这不会将单元格格式化为超链接单元格。 You need to format it separately. 您需要单独格式化它。 But if you hover your mouse you can find the link. 但是如果你将鼠标悬停在上面就可以找到链接。 By clicking on that cell, it will take you to appropriate sheet. 通过单击该单元格,它将带您到适当的工作表。

Apparently, internal links are not yet supported (as of 0.10.5): 显然,尚不支持内部链接(截至0.10.5):

https://github.com/SheetJS/js-xlsx/issues/685 https://github.com/SheetJS/js-xlsx/issues/685

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM