Apache OpenOffice (AOO) Bugzilla – Issue 16179
saving of a new basic library not possible while OO is runing ...
Last modified: 2009-02-05 16:02:56 UTC
Hi, I have a problem with the saving of a new basic library while OO is runing. Oliver ' This will create a new Library in \user\basic\ with the files: ' ' Mylib\Module1.xba ' Mylib\script.xlb ' Mylib\dialog.xlb ' ' It seems, that the files are written to harddisk only at the time, ' OO is closed, cause I cannot find the files in the Windows-Explorer/ ' with the SimpleFileAccess ... ' ' How can I force saving directly after creating ??? Sub CreateLibrary Dim oLib as Object Dim oLibContainer as Object Dim sLib as String Dim oFileAccess as Variant Dim oSettings as Object Dim oPathSettings as Object Dim mFolder() as String Dim sPath as String Dim sMsg as String Dim i as Integer sLib = "MyLib" oLibContainer = Globalscope.BasicLibraries If oLibContainer.hasByName(sLib) Then oLibContainer.removeLibrary(sLib) EndIf oLib = oLibContainer.createLibrary(sLib) oLib.insertByName("Module1", "REM *** TEST ***") oLibContainer = Globalscope.DialogLibraries If oLibContainer.hasByName(sLib) Then oLibContainer.removeLibrary(sLib) EndIf oLib = oLibContainer.createLibrary(sLib) ' try to get office path ... oSettings = createUnoService("com.sun.star.frame.Settings") oPathSettings = oSettings.getByName("PathSettings") sPath = oPathSettings.getPropertyValue("Basic") sPath = Mid(sPath, InStr(1, sPath, ";")+1, Len(sPath)) & "/" & sLib & "/" ' try to get the files ... oFileAccess = createUnoService("com.sun.star.ucb.SimpleFileAccess") If oFileAccess.exists(sPath) and oFileAccess.IsFolder(sPath) Then sMsg = "" mFolder() = oFileAccess.getFolderContents(sPath, False) for i = lbound(mFolder()) to uBound(mFolder()) sMsg = sMsg & mFolder(i) & Chr(13) next i msgBox sMsg Else msgBox "Can't find files in " & sPath EndIf End Sub
Andreas, please help.
Unfortunately the saving is not (yet) part of the library container API. Currently all new or changed libraries are stored automatically when the office is terminated. Maybe this problem will also be adressed in the context of the scripting framework developement.
Hi, it seems this issue has been fixed in oo 2.0 ... at least i can not verify it with oo 2.0.2. rc (you can't use the above script to verify this, cause oSettings = createUnoService("com.sun.star.frame.Settings" return *null* with oo 2.0.2. (it's marked as deprecated) but it's still in so 7.0 pu 6 ... cause i do not think one will fix it for so 7.0, it should be closed ... :-) Oliver
Ok, I will close it -> WORKSFORME
CLOSED