You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在LibreOffice Writer状态栏添加并显示文档模板名称?

在LibreOffice Writer状态栏显示模板名称的问题

需求:在LibreOffice Writer的状态栏中,像显示样式名称那样显示当前文档的模板名称。

尝试1:修改statusbar.xml

  1. 从系统路径 \share\config\soffice.cfg\modules\swriter\statusbar 获取statusbar.xml中样式名称状态栏项的代码片段:
<statusbar:statusbaritem xlink:href=".uno:PageStyleName" statusbar:align="left" statusbar:autosize="true" statusbar:width="79"/>
  1. 将该文件复制到用户目录 \config\soffice.cfg\modules\swriter\statusbar,并添加自定义状态栏项代码,试图通过调用文档属性获取模板名称:
<statusbar:statusbaritem xlink:href=".uno:ThisComponent.getDocumentProperties().TemplateName" statusbar:align="left" statusbar:autosize="true" statusbar:width="79"/>

结果:仅生成79像素宽度的状态栏区域,未成功显示模板名称。

尝试2:使用宏代码

从《Useful Macro Information For OpenOffice.org By Andrew Pitonyak》中获取以下宏代码:

Function ProgressBar
  ProgressBar = ThisComponent.CurrentController.StatusIndicator
End Function

Sub StatusText()
  Dim sInformation 
  Dim iLen as Integer
  Dim iRest As Integer
  sInformation = ThisComponent.getDocumentProperties().TemplateName
  iLen=Len(sInformation)
  iRest=350-iLen
  ProgressBar.start(sInformation+SPACE(iRest),0)
End Sub

结果:宏可以正常显示模板名称,但会隐藏状态栏的其他项目,无法实现“在样式名称旁显示”的需求。

内容的提问来源于stack exchange,提问作者shantanuo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.08 10:55:16