libreoffice python access Property object

Viewed 36

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']
1 Answers

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')>)>
Related