Home of site/Basic Macro General2

Macroの杜(LibreOffice Basic編 / Genral)


Libreoiifce/AOOのバージョン取得
< 戻る

GDPi-)[General]ScriptForgeを用いたVersion取得(LibreOfficeのみ)
【Picture】実行結果
 ScriptForgeの中の
 
	Platform service の OfficeVersionプロパティ

 を利用します。

	

Sub LOVersion()
	GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")
	Dim platform As Variant
	Dim oDisp as String
		platform = CreateScriptService("Platform")
		oDisp = "【Version】" & Chr(10) & platform.OfficeVersion
		msgbox oDisp
End Sub




GDPi-)[General]その他の方法

ScriptForgeは比較的新しい LibreOffice(LO)にだけ対応可能ですが、
Apache OpenOffice(AOO)やOpenOffice.orgでも利用な方法として

	1.GetSolarVersion
	
	2.ConfigurationAccessサービス
	
を利用する方法があります。



----------------------------------------------------------------------------------------------------

LO/AOOのVersion取得(GetSolarVersion )
【Picture】実行結果 【Picture】実行結果 Sub OOoVersion1 Dim OOoVer as String OOoVer = GetSolarVersion MsgBox("The version of this LibreOffice is " & Chr$(10) & Chr$(9) & Chr$(9) & _ "ver. " & OOoVer, 0, "LibreOffice Version") End Sub ' ' [ Note ] ' LibreOffice4.4 からGetSolarVersionのReturn値の形式が変更 ' Release Note ' ⇒ Changed the value returned from GetSolarVersion. Before this change the returned value was one number for version major, minor and micro. So, for version 4.4.0, the returned value was 440. Now we're using two decimals for version major, two for version minor and one for version micro. The new format is 40400, for version 4.4.0. fdo#60689
----------------------------------------------------------------------------------------------------
LO/AOOのVersion取得(ConfigurationAccessサービス)
【Picture】実行結果 【Picture】実行結果 Sub OOoVersion2() Dim oSet as Object, oConfigProvider as Object Dim oParm(0) As New com.sun.star.beans.PropertyValue Dim oProvider$, oAccess$ Dim OOoVer As String oProvider = "com.sun.star.configuration.ConfigurationProvider" oAccess = "com.sun.star.configuration.ConfigurationAccess" oConfigProvider = createUnoService(oProvider) oParm(0).Name = "nodepath" oParm(0).Value = "/org.openoffice.Setup/Product" oSet = oConfigProvider.createInstanceWithArguments(oAccess, oParm()) OOoVer = oSet.getByName("ooSetupVersion") MsgBox("The version of this LibreOffice is " & Chr$(10) & Chr$(9) & Chr$(9) & _ "ver. " & OOoVer, 0, "LO 4.4.1.2") End Sub ' ' [ Note ] ' LO Ver4.4 でもRetrurn値の変更は無い。
inserted by FC2 system