Help Info.get_user_defined_props() method

Overview

LibreOffice allows you to assign custom information fields to your document as seen in Fig. 1188

Custom properties of my_spreadsheet

Fig. 1188 Custom properties of my_spreadsheet

Info.get_user_defined_props method is used to get the user defined properties of a document.

The Info.get_user_defined_props method returns a XPropertyContainer interface.

This method is used to get the user defined properties of a document.

Example

import uno
from com.sun.star.beans import XPropertySet
from ooodev.loader.lo import Lo
from ooodev.office.calc import Calc
from ooodev.utils.info import Info

# ... other code

doc = Calc.open_doc(fnm="my_spreadsheet.ods")
user_props = Info.get_user_defined_props(doc)
# get properties as XPropertySet
ps = Lo.qi(XPropertySet, user_props, True)
assert int(ps.getPropertyValue("PrintSheet")) == 2
assert ps.getPropertyValue("PrinterName") == "Brother MFC-L2750DW series"