Ask Your Question
0

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

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

owlbrudder gravatar image

updated 2020-07-11 20:33:14 +0100

Alex Kemp 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 reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-09-25 17:06:42.245269

1 Answer

Sort by » oldest newest most voted
1

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

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 +0100 )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 +0100 )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 +0100 )edit

Question Tools

1 follower

Stats

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

Seen: 985 times

Last updated: Feb 24 '17