简体   繁体   English

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

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

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

AFAIK, you can't get the name directly. AFAIK,你不能直接得到名字。 But you could use the CELL function with its filename parameter to get a string containing path, filename and table name of the current cell.但是您可以使用带有filename参数的CELL function来获取包含当前单元格的路径、文件名和表名的字符串。 Using that string, you can extract the table name as follows:使用该字符串,您可以按如下方式提取表名:

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

Split on multiple lines:拆分多行:

 =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
      )
  )

inspired by a OOo forum post from villeroy灵感来自 villeroyOOo 论坛帖子

Depending on your localization, you may have to replace the semicolons ;根据您的本地化,您可能需要替换分号; by commas , .用逗号, .

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

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