LibreOffice environment variables

I would like to be able to pre-configure user paths, unfortunately the locations are user and branch specific. I am wondering if LibreOffice supports any of the following:

  1. Can LibreOffice use OS environment variables, such as %username%?. OR
  2. Can LibreOffice read from values in org.openoffice.UserProfile\Data (The User Data screen in LibreOffice)?

I can pre-fill the User Data from LDAP using oo-ad-ldap.xcd.

I have found this document, these paths aren’t that useful if you want to modify the paths away from the user profile. Also the documentation for $(home) is incorrect as I have found it points to %userprofile%\Documents rather than %userprofile%.

I open a worksheet named yearlyplanning.ods which is in the desktop of my current user profile.

It is something like this:

dim oProps()

oPathsub = createUnoService("com.sun.star.util.PathSubstitution")
sFile = "$(home)/../Desktop/yearlyplanning.ods"

sUrl =  oPathsub.substituteVariables(sFile, True)
oCalcDoc = StarDesktop.loadComponentFromURL(sUrl, "_blank", 0, oProps)

Because $(home) is expanded to %userprofile%\Documents, so I did $(home)\.. to give me %userprofile%

Edit:
$(username) is working now since LibreOffice 5.2

1 Like