Ask Your Question
0

Globalscope.BasicLibraries.LoadLibrary(<lib name>) etc. not working

asked 2017-02-24 06:51:16 +0200

owlbrudder gravatar image

I am working through examples from Andrew Pitonyak's 'AndrewPersonalLibs.odt' and have hit a problem.

In library AndrewTestLib, module Module1 is a macro CopyLibToDoc. In this is a couple of lines of code designed to load a library which I have edited to 'AndrewBase':

sLName = "AndrewBase"
If (Not Globalscope.BasicLibraries.isLibraryLoaded(sLName)) Then
    Globalscope.BasicLibraries.LoadLibrary(sLName)
End If

The trouble is, this does not work for some reason. image description

As you can see from the MRI window, the only accessible libraries are from 'My Macros & Dialogs' and 'LibreOffice Macros & Dialogs'. Any attempt to load any of the other libraries through code gives the same result: the library cannot be found, cannot be loaded etc.

Is there something I am missing?

Thanks, Doug

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2017-02-24 07:16:18 +0200

You may find this useful: https://wiki.openoffice.org/wiki/Docu...

GlobalScope doesn't relate to open documents' libraries. If you use a library from current document, you need to use BasicLibraries instead of Globalscope.BasicLibraries.

edit flag offensive delete link more

Comments

Thanks Mike - that solved it. Why does the "Elements" list of oDocLibCont and oLibCont not list the library I have just loaded:

oDocLibCont = createUnoService("com.sun.star.script.DocumentScriptLibraryContainer") subInspect(oDocLibCont) oLibCont = createUnoService("com.sun.star.script.ApplicationScriptLibraryContainer") subInspect(oLibCont)

Also, can I load the library of Document A from Document B?

owlbrudder gravatar imageowlbrudder ( 2017-02-24 21:50:25 +0200 )edit

As for second question - oDoc.BasicLibraries works for any opened oDoc.

See http://api.libreoffice.org/docs/idl/r...

See http://api.libreoffice.org/docs/idl/r...

Mike Kaganski gravatar imageMike Kaganski ( 2017-02-24 23:12:13 +0200 )edit

Excellent. Thanks Mike - I now have some more research to do - just love learning new stuff. "8-)

owlbrudder gravatar imageowlbrudder ( 2017-02-25 08:44:24 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-02-24 06:51:16 +0200

Seen: 359 times

Last updated: Feb 24 '17