首页 文章

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

提问于
浏览
1

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

1 回答

  • 1

    AFAIK,你不能直接得到这个名字 . 但是你可以使用CELL function及其 filename 参数来获取包含当前单元格的路径,文件名和表名的字符串 . 使用该字符串,您可以按如下方式提取表名:

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

    灵感来自villeroy的OOo论坛帖子

    根据您的本地化,您可能必须用逗号 , 替换分号 ; .

相关问题