Chrstophe,
maybe this 2 BASIC subs clould help
sub AddBasicLibrary(srcname,destname)
Dim oSrcDoc as object
Dim SrcLibraryName As String, DestLibraryName As String
Dim oSrcLib As Object, oDestLib As Object, iCounter As Integer
Dim oSrc2Lib As Object , oDest2Lib As Object
Dim iLib As Integer
Dim ModuleName AS String, oModule AS Object
Dim sSrcModules
' set these 2 variables to your lib name
SrcLibraryName = srcname' library that contains the modules
DestLibraryName = destname
' This library will be created and is the
' destination for the modules from the source document.
Dim mFileProperties(0) As New com.sun.star.beans.PropertyValue
mFileProperties(0).Name="Hidden"
mFileProperties(0).Value= true
' on local error goto geenfile
oSrcDoc =
StarDesktop.LoadComponentFromURL(ConvertToURL("t:\template\artikels\macros\Macros_Opmaak_artikels_LaatsteVersie.odt"),
"_blank", 0, mFileProperties())
oSrcLibs = oSrcDoc.BasicLibraries
oDestLibs = BasicLibraries 'out of this document
oSrcLibs.LoadLibrary(SrcLibraryName) '[DL] Added LoadLibrary
For iLib = 1 To 2 ' this makes two passes, one for the dialogues and one
for the macros
If oDestLibs.hasByName( DestLibraryName ) = TRue Then
DeleteBasicLibrary( DestLibraryName) ' = SUB om leeg te maken
oDestLibs.createLibrary(DestLibraryName )
else
oDestLibs.createLibrary(DestLibraryName )
End If
If oSrcLibs.hasByName( SrcLibraryName ) Then
oSrcLib = oSrcLibs.getByName( SrcLibraryName )
oDestLib = oDestLibs.getByName(DestLibraryName)
sSrcModules = oSrcLib.getElementNames()
iCounter = lBound( sSrcModules() )
while( iCounter <= uBound( sSrcModules() ) )
If oDestLib.hasByName( sSrcModules(iCounter) ) = False Then
' On Error Goto ErrorHandler
oDestLib.insertByName( sSrcModules(iCounter),
oSrcLib.getByName( sSrcModules(iCounter) )
End If
iCounter = iCounter + 1
wend
End If
oSrcLibs = oSrcDoc.DialogLibraries 'DialogLibraries ' The same for
the Dialog libraries
oDestLibs = DialogLibraries
oSrcLibs.LoadLibrary( SrcLibraryName ) '[DL] Added LoadLibrary
Next iLib
'end if
oSrcDoc.dispose
Exit sub
Geenfile:
' Style = 48 'OKonly + Exclamation
MsgBox "ERROR bij het laden van
t:\template\artikels\macros\Macros_Opmaak_artikels_LaatsteVersie.odt" &
chr(13) & "Bestaat niet !!!"
' AddBasicLibrary = False
End Sub
Sub DeleteBasicLibrary( srcname)
Dim DelLibraryName As String
Dim oDelLib As Object, iCounter As Integer
Dim oLib As Object, oGlobalLib As Object
Dim iLib As Integer
Dim sSrcModules
DelLibraryName = srcname
oLib = BasicLibraries ' For Basic libaries in this document
For iLib = 1 To 2 ' this makes two passes, one for the dialogues and one
for the macros
If oLib.hasByName( DelLibraryName ) Then
oLib.removeLibrary( DelLibraryName )
End If
oLib = DialogLibraries
Next iLib
End Sub
On 05/10/2017 11:00, CHRISTOPHE JOYAU wrote:
Hello,
I'm looking for a way to import Basic Libraries with Open Office 4.X about
Libraries of a component (not about Globalscope Libraries).
I know to export with :
Librairies=BasicLibrairies
For Each Librairie In Librairies()
BasicLibraries.exportLibrary(Librairie.Name,ConvertToUrl(Chem &
"Basic"),com.sun.star.ucb.AuthenticationRequest)
Next
So i get in directory Chem & "Basic" => xba and xlb
I 'd like to do inverse operation and it 's not working if i use
BasicLibraries.CreateLibraryLink(R,ConvertToUrl(Chem & "Basic\" & R),False)
With this command i can obtain a new library R in my component but with an error and it's
empty and with a password " " ( it's mad !) .
Could you please endicate the good command to import libraries ?
Thank you for your attention and i hope your answer !
Avec mes salutations,
Christophe Joyau
Pupitreur assistant-Utilisateurs
C entre I nterrégional de S aisie des D onnées
22 bis avenue du 8 mai 1945
95200 Sarcelles
Tel : 09.70.27.18.57
' Ensemble des librairies contenues dans Clas ( il aurait été plus simple
d'utiliser seulement )
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
For additional commands, e-mail: dev-h...@openoffice.apache.org