Ask Your Question
0

Which method should we used in place of getDocumentInfo() in libreoffice 4?

asked 2018-10-17 12:24:38 +0100

vinita gravatar image

This works fine with openoffice to save data in custom properties but failed in libreoffice4. XDocumentInfoSupplier is depricated for libreoffice4. Which method should I use to save data in custom properties of libreoffice4?

xDocumentInfoSupplier = (XDocumentInfoSupplier) UnoRuntime.queryInterface(XDocumentInfoSupplier.class, IDSManager.xSpreadsheetDocument); docInfo = xDocumentInfoSupplier.getDocumentInfo();

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2018-10-17 12:48:55 +0100

See relevant release notes.

edit flag offensive delete link more

Comments

Thanks, Mike.

But my problem is XDocumentProperties interface does not contain any method which saves the data in custom properties of LibreOffice like getDocumentInfo() do in OpenOffice.

vinita gravatar imagevinita ( 2018-10-17 13:20:58 +0100 )edit

It gives you access to them via getUserDefinedProperties().

Mike Kaganski gravatar imageMike Kaganski ( 2018-10-17 13:35:59 +0100 )edit

But how should we add them in custom properties?

vinita gravatar imagevinita ( 2018-10-17 13:54:55 +0100 )edit

This code in StarBASIC works for me:

d = ThisComponent
dp = d.getDocumentProperties()
up = dp.getUserDefinedProperties()
If (Not up.getPropertySetInfo().hasPropertyByName("MyPropName")) Then
  up.addProperty("MyPropName", 1, "")
EndIf
up.setPropertyValue("MyPropName", "5")

The changed value isn't visible until save-and-reload though.

Mike Kaganski gravatar imageMike Kaganski ( 2018-10-17 14:16:00 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-10-17 12:24:38 +0100

Seen: 22 times

Last updated: Oct 17 '18