libreoffice python访问属性对象

发布于 2025-02-09 10:18:43 字数 490 浏览 1 评论 0原文

鉴于以这种方式获取的变量属性的属性

view_settings = current_controller.ViewSettings
property_set=view_settings.getPropertySetInfo()
properties=property_set.getProperties()

如何访问值。

例如:

 (com.sun.star.beans.Property){ Name = (string)"ZoomValue", Handle = (long)0x1b, Type = (type)short, Attributes = (short)0x0 }

这些失败:

properties.ZoomValue
properties.getattr('ZoomValue')
properties['ZoomValue']

Given this Property of the variable properties acquired in this way

view_settings = current_controller.ViewSettings
property_set=view_settings.getPropertySetInfo()
properties=property_set.getProperties()

How do I access the values.

For example:

 (com.sun.star.beans.Property){ Name = (string)"ZoomValue", Handle = (long)0x1b, Type = (type)short, Attributes = (short)0x0 }

These fail :

properties.ZoomValue
properties.getattr('ZoomValue')
properties['ZoomValue']

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

↘紸啶 2025-02-16 10:18:43

似乎您有点迷路了。

It seems like you got a little lost. ???? This is enough to get the value.

view_settings = current_controller.ViewSettings
view_settings.ZoomValue

getPropertySetInfo() tells information about the properties rather than giving access to the property values. For example you could determine the property type like this:

propinfo = property_set.getPropertyByName('ZoomValue')
propinfo.Type

Result:

<Type instance short (<Enum instance com.sun.star.uno.TypeClass ('SHORT')>)>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文