libreoffice Writer Python脚本以设置查看布局列
对于Lo Writer中的文本文档,我希望一个快捷方式可以在1和2列之间切换视图。为此,我录制了两个宏 - 没有效果 - 所以我正在尝试使用Python。
Writer Menu.View.Zoom.Zoom菜单项打开Zoom并查看布局
对话框。该对话框提供了两个面板: Zoom 和查看布局
在Python脚本中,我们可以访问Current_controller.view_settings.zoomvalue
和... ZoomType
,但我找不到查看布局
值的方法。
在lo用户配置文件registrymodifications.xcu
中,我们有这三行:
<item oor:path="/org.openoffice.Office.Writer/Layout/Zoom"><prop oor:name="Type" oor:op="fuse"><value>0</value></prop></item>
<item oor:path="/org.openoffice.Office.Writer/Layout/Zoom"><prop oor:name="Value" oor:op="fuse"><value>120</value></prop></item>
<item oor:path="/org.openoffice.Office.Writer/Layout/ViewLayout"><prop oor:name="Columns" oor:op="fuse"><value>1</value></prop></item>
请注意,在layout
下,两个缩放值直接通过view_settings访问(请参阅多于)。在同一级别上,我们有ViewLayout,但是在脚本中,我找不到访问我想成为的内容view_settings.viewlayout
或view_settings.getProperty(...)
For text documents in LO writer I want a shortcut to toggle the view between 1 and 2 columns. To that end, I recorded two macros -- which had no effect -- so I'm trying with Python.
The Writer Menu.View.Zoom.Zoom menu item opens the Zoom and View Layout
dialog. That dialog offers two panels: Zoom and View Layout
In a Python script we can access current_controller.view_settings.ZoomValue
and ...ZoomType
but I don't find a way to the View Layout
values.
In the LO user config file registrymodifications.xcu
we have these three lines:
<item oor:path="/org.openoffice.Office.Writer/Layout/Zoom"><prop oor:name="Type" oor:op="fuse"><value>0</value></prop></item>
<item oor:path="/org.openoffice.Office.Writer/Layout/Zoom"><prop oor:name="Value" oor:op="fuse"><value>120</value></prop></item>
<item oor:path="/org.openoffice.Office.Writer/Layout/ViewLayout"><prop oor:name="Columns" oor:op="fuse"><value>1</value></prop></item>
Notice that the two zoom values are at the same level under Layout
accessed in script directly through view_settings (see above). At that same level we have ViewLayout but in a script I have found no way of accessing what I would like to be view_settings.ViewLayout
or view_settings.getProperty(...)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我还没有学会使用Python来控制LO,但是应该可以致电调度员。我录制了一个宏,但没有发现正在修改的ViewLayout。查看您提供的信息,我想到了这一点,它努力更改为3列。
I haven't learned to use Python to control LO, but it should be possible to call the Dispatcher. I recorded a macro, but didn't find the ViewLayout being modified. Looking at information you provided, I came up with this, which worked to change to 3 columns.