2020-08-23

47: Using Python Instead of Basic For Your LibreOffice

<The previous article in this series | The table of contents of this series | The next article in this series>

If your LibreOffice shows not-so-advisable Basic as the sole macro language option, you can add Python.

Topics


About: UNO (Universal Network Objects)
About: LibreOffice
About: Apache OpenOffice
About: The Python programming language

The table of contents of this article


Starting Context


  • The reader has a basic knowledge on LibreOffice or Apache OpenOffice.
  • The reader has a basic knowledge on the Python programming language.

Target Context


  • The reader will know how to enable Python as an option for his or her LibreOffice macro.

Orientation


Using an external full Python has been addressed in the previous article.

Creating your user-owned, application-owned, or in-document Python macro will be addressed in some future articles.

Executing any macro (user-owned, application-owned, or in-document) function from your UNO program will be addressed in a future article.

Incorporating your Python macro into your LibreOffice or Apache OpenOffice extension will be addressed in a future article.

Details of Python macro programming will be dug into in some future articles.

Stage Direction
Here are Hypothesizer 7, Objector 47A, and Objector 47B in front of a computer.


Main Body


1: You Do Not Need to Use Basic for Your LibreOffice Macro


Hypothesizer 7
If your LibreOffice is a pre-installed one in a Linux distribution, it may show Basic as the sole macro language option (in fact, my pre-installed LibreOffice in my lubuntu 20.04 did so), which does not mean that you need to use Basic for your macro.

Objector 47A
. . . You are as though I am using it grudgingly.

Hypothesizer 7
Are you not, sir?

Objector 47A
Well, I admit, LibreOffice Basic is shoddy.

Hypothesizer 7
To say nothing of its insufficient functionality (no user-defined class, no multiple threads, no map, etc.), its foundation as a programming language is not seriously conceived or documented (is each variable a pointer, a reference, or a datum container (so called "value type" variable)?; Static variables cannot be initialized at will; etc.).

Objector 47B
You people are gunning for Basic!

Objector 47A
Lady, it's shoddy, objectively speaking.

Hypothesizer 7
Madam, I do not want to malign anything, but should people be left unwarned about a . . .

Objector 47A
. . . shoddy, you mean.

Hypothesizer 7
. . . about a not-so-advisable option?

Objector 47B
Well, they shouldn't, of course, but that doesn't mean that you should bad-mouth something!

Hypothesizer 7
. . . I do not understand how you define "bad-mouth"; if you call 'correctly indicating deficiencies' "bad-mouth"ing, it will be impossible to do the due warning without "bad-mouth"ing.

Objector 47B
Just don't do bad-mouthing, OK?!

Hypothesizer 7
I just do not understand how I can . . .


2: Installing Some Operating System Packages or Opting for a Downloaded LibreOffice


Hypothesizer 7
In my lubuntu (which is a derivative of Ubuntu), I can just install an operating system package, 'libreoffice-script-provider-python', which may automatically installs also some necessary packages.

Objector 47A
What for other distributions?

Hypothesizer 7
I am not sure about other distributions, but they should have corresponding packages, I guess.

Objector 47A
. . . A vague response.

Hypothesizer 7
I am sorry that I cannot research for all the various distributions, but if you cannot find one for your distribution, you can install LibreOffice with a downloaded package from the download site, which (the package) should include the Python option.


References


  • The Document Foundation. (n/a). Download LibreOffice | LibreOffice. Retrieved from https://www.libreoffice.org/download/download/
<The previous article in this series | The table of contents of this series | The next article in this series>