I’m looking to find useful debug information using UNO about the Office instance and the (Writer) document currently open in it. I found some document metadata in the DocumentProperties of the XDocument interface (e.g. Author, Generator, …).
What I’d also like though, are:
Name and version of the currently running Office instance; and
More detailed information about the file that’s been loaded, i.e. file format, its version (if available), etc.
Is such information available, and if so, how?
Thanks
Last edited by _savage on Sun Dec 17, 2017 4:27 pm, edited 2 times in total.
Mac 10.14 using LO 7.2.0.2, Gentoo Linux using LO 7.2.3.2 headless.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Thank you Zizi! I also found a somewhat related question in this forum here. For those interested, here is the Python code based on Zizi’s macro and other resources:
>>> import uno
>>> sm = uno.getComponentContext().ServiceManager
>>> service = sm.createInstanceWithContext("com.sun.star.configuration.ConfigurationProvider", uno.getComponentContext())
>>> from com.sun.star.beans import PropertyValue
>>> pv = PropertyValue()
>>> pv.Name = "nodepath"
>>> pv.Value = "/org.openoffice.Setup/Product"
>>> settings = service.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", (pv,))
>>> # Use settings.getProperties() to inspect what properties are available.
>>> settings.getByName("ooName")
'LibreOffice'
>>> settings.getByName("ooSetupVersionAboutBox")
'5.4.3.2'
>>> settings.getByName("ooXMLFileFormatVersion")
'1.0'
More information under Reading Configuration Data, although I couldn’t find anything yet that leads me to configuration/meta data about the currently open document.
Mac 10.14 using LO 7.2.0.2, Gentoo Linux using LO 7.2.3.2 headless.
I couldn’t find anything yet that leads me to configuration/meta data about the currently open document
Look at sections 13.3 and 13.4 in Andrew Pintonyak's "OpenOffice.org Macros Explained" you may find what you need there. http://www.pitonyak.org/oo.php
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
UnklDonald418 wrote:Look at sections 13.3 and 13.4 in Andrew Pintonyak's "OpenOffice.org Macros Explained" you may find what you need there. http://www.pitonyak.org/oo.php
Thank you! That’s a helpful document you linked there, and using the references I was able to dig up some information about a currently opened Writer document:
However, is there no way to find more information about the file type itself, perhaps a file format version? When Writer selects an import filter, then that information must surely be available at some point…
Last edited by _savage on Sun Dec 17, 2017 4:25 pm, edited 1 time in total.
Mac 10.14 using LO 7.2.0.2, Gentoo Linux using LO 7.2.3.2 headless.
However, is there no way to find more information about the file type itself, perhaps a file format version? When Writer selects an import filter, then that information must certainly be available at some point…
I suppose it: When the document is loaded by the AOO/LO Writer application into the system memory, then the document format is ODF 1.1 or ODF 1.2. (Depended on the settings in the Tools - Options - Load/Save - General - Default File Formats and ODF settings...)
The AOO/LO Writer (the import filter of the Writer) always converts the opened document into ODF format, because it can work in the native format only. (Of course you can choose another format at the "Save as" function.)
Note: use the XrayTool or the MRI to examine the properties and methods of the objects.)
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Great, looks like the “FilterName” property value (one of the values returned by getArgs()) is what I was still looking for
Note, however, that the document statistics for a Writer document may be incomplete if the document hasn’t finished loading. Related threads here or here and probably there are some more.
Mac 10.14 using LO 7.2.0.2, Gentoo Linux using LO 7.2.3.2 headless.