creating a new module in a chosen library using libreoffice basic

48 views Asked by At

How can I create a new module in a chosen library using libreoffice basic code?

I've tried: ThisComponent.getLibraryContainer().getByName("C_calc").getModuleContainer().insertByName("newModule", "") with no effect. It throws an exception:

Type:com.sun.star.lang.IllegalArgumentException Message: types do not match at ./basic/source/basmgr/basmgr.cxx:1738.

How can I solve this problem?

1

There are 1 answers

0
Jim K On

XStarBasicAccess::getLibraryContainer() is deprecated. Use BasicLibraries instead.

oLibs = BasicLibraries
oLib = oLibs.getByName("C_calc")
oLib.insertByName("newModule", "REM hello")