如何让单元格在 LibreOffice Calc 中显示 table 的名称?

How to have a cell display the table's name in LibreOffice Calc?

所以,基本上我想让一个单元格显示它所在的 table 的名称。我想出了如何获取 table ID,从 1 开始,但不知道如何获取它的名称。

据我所知,您无法直接获取名称。但是您可以使用 CELL function 及其 filename 参数来获取包含当前单元格的路径、文件名和 table 名称的字符串。使用该字符串,您可以提取 table 名称,如下所示:

=RIGHT(CELL("filename");LEN(CELL("filename"))-FIND("$";CELL("filename")))

分多行:

 =RIGHT(                    # return substring from the right
     CELL("filename");      # of the filename (incl. table name)
     LEN(                   # calculate the length of the table name substring:
          CELL("filename")  # take the complete filename string;
      ) -                   # and subtract ...
      FIND(                 # the position...
          "$";              # of the dollar sign (preceding the table name)
          CELL("filename")  # of the "filename" string
      )
  )

灵感来自OOo forum post from villeroy

根据您的本地化,您可能需要将分号 ; 替换为逗号 ,