如何以跨平台方式创建与本地文件的相对超链接?

发布于 2025-02-11 05:23:55 字数 139 浏览 0 评论 0原文

我希望能够创建一个XLSX文件,该文件包含在同一目录中或子目录中的文件中的链接,并且能够在不同的平台(MacOS,Linux,Windows)和不同的电子表格上打开它们程序(Excel,Libreoffice,Apple号码)。

I want to be able to create a XLSX file which contains links to files in the same directory or in sub-directories and be able to open them on different platforms (macOS, Linux, Windows) and different spreadsheet programs (Excel, LibreOffice, Apple Numbers).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

伤感在游骋 2025-02-18 05:23:55

Apple号码完全不支持Local 超链接 S。

以下公式在MacOS,Linux和Windows上工作,以及Libreoffice和Excel:

=HYPERLINK(
  SUBSTITUTE(
    LEFT(
      SUBSTITUTE(CELL("filename"), "\", "/"),
      FIND(
        "?",
        SUBSTITUTE(
          SUBSTITUTE(CELL("filename"), "\", "/"),
          "/",
          "?",
          LEN(SUBSTITUTE(CELL("filename"), "\", "/"))
            - LEN(
                SUBSTITUTE(
                  SUBSTITUTE(CELL("filename"), "\", "/"),
                  "/",
                  ""
                )
              )
        )
      )
    ) & "{{ filename }}",
    "'file://",
    ""
  ),
  "{{ filename }}"
)

替换{{filename}}},并使用要打开的文件。

说明:

  • 将所有\替换为/,以便在Windows cell上正确计算
  • (“ fileName”)获取当前电子表格文件的路径,但是稍微在Excel和Libreoffice方面有所不同。因此,必须删除libreoffice特定'文件://

Apple Numbers does not support local HYPERLINKs at all.

Following formula works on macOS, Linux, and Windows and with LibreOffice and Excel:

=HYPERLINK(
  SUBSTITUTE(
    LEFT(
      SUBSTITUTE(CELL("filename"), "\", "/"),
      FIND(
        "?",
        SUBSTITUTE(
          SUBSTITUTE(CELL("filename"), "\", "/"),
          "/",
          "?",
          LEN(SUBSTITUTE(CELL("filename"), "\", "/"))
            - LEN(
                SUBSTITUTE(
                  SUBSTITUTE(CELL("filename"), "\", "/"),
                  "/",
                  ""
                )
              )
        )
      )
    ) & "{{ filename }}",
    "'file://",
    ""
  ),
  "{{ filename }}"
)

Replace {{ filename }} with the file you want to open.

Explanation:

  • Replace all \ with / for correct calculations on Windows
  • CELL("filename") gets the path of the current spreadsheet file, but slightly differently in Excel and LibreOffice. Therefore the LibreOffice specific 'file:// must be removed.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文