OO-Snippets: Verion of OOffice

Commons

KeywordsGetSolarVersion, Version, Configuration, ConfigurationProvider, ConfigurationAccess, createInstanceWithArguments
LanguageOOBasic
ApplicationOffice
AuthorsAndrew Pitonyak
Laurent Godard
Tom Schindl
Supported Versions
Supported OS
Question What version of OpenOffice.org am I running?
Answer

The GetSolarVersion() function returns an integer representing the internal build number. Version 1.0.3.1 returns "641" and 1.1RC3 returns "645". The following Macro by Laurent Godard uses a ConfigurationProvider to extract the version as a text string from the XML configuration file.

Code-Snippet-Listing (snippet-source)

Function OOoVersion() As String
  'Retreives the running OOO version
  Dim aSettings, aConfigProvider
  Dim aParams2(0) As new com.sun.star.beans.PropertyValue
  Dim sProvider$, sAccess$
  sProvider = "com.sun.star.configuration.ConfigurationProvider"
  sAccess   = "com.sun.star.configuration.ConfigurationAccess"
  aConfigProvider = createUnoService(sProvider)
  aParams2(0).Name = "nodepath"
  aParams2(0).Value = "/org.openoffice.Setup/Product"
  aSettings = aConfigProvider.createInstanceWithArguments(sAccess, aParams2())
  OOOVersion=aSettings.getbyname("ooSetupVersion")
End Function

Changelog

DateUserModification
2004-06-22tomsontomModified to match new snippet-DTD
0000-00-00andInitial version

and