We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question

What's the best language to use for calc macros? [closed]

asked 2012-07-24 23:39:23 +0200

dbw gravatar image

updated 2021-07-04 17:11:28 +0200

Alex Kemp gravatar image

Should I write macros for calc in LIbreOffice Basic or in Python or some other language?

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 2015-10-18 04:25:44.041778

3 Answers

Sort by » oldest newest most voted

answered 2012-09-27 15:38:29 +0200

CyanCG gravatar image

Do you have any programming background? If so and if you already know Python, then by all means do use it in Calc. All functions of the LibreOffice API can be accessed from the different languages; it is easier for beginners to use StarBasic, as it is straightforward, but Python is more "powerful", in a way, because it allows you to create new "UNO services", which more or less means adding new functionality that didn't exist in LibreOffice to begin with.

On the other hand, statements and functions are generally more verbose in, e.g., Python and JavaScript, than the equivalent statements and subroutines in Basic. At any rate, it is necessary to first understand the API functions (see the OpenOffice documentation wiki) before setting out to write complex macros.

Finally, it is important to note that the macros recorded with the experimental macro recorder use Basic, but do not use the API calls; instead, they use a service called the dispatcher, which is limited to emulating the commands issued by the user through the graphical user interface.

edit flag offensive delete link more

answered 2012-09-27 02:02:55 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

please how to code an object variable and use it. I created a form out of Calc, with Dialog1 containing 2 command buttons (start and end) 1 box text. At the start button opens box question (inputbox) and the variable containing the response, showing in the text box (textField1). I need the codes written in Module1. thank you

edit flag offensive delete link more



Hi @Renato Olechnovicius, Please take the content of your Answer and ask it as a new Question. Thanks!

qubit gravatar imagequbit ( 2013-01-29 10:04:54 +0200 )edit

answered 2012-10-03 06:40:43 +0200

Yeah, Python! I really came here to find out if Python works reliably with calc.

edit flag offensive delete link more


Oops, I guess you meant to post a comment and posted an answer instead ;-). I do not know for sure wether Python is more stable than StarBasic for Calc macros, but I do know that it can access the complete API. See the API documentation and this article: http://wiki.openoffice.org/wiki/Python

CyanCG gravatar imageCyanCG ( 2012-10-03 19:56:54 +0200 )edit

Question Tools


Asked: 2012-07-24 23:39:23 +0200

Seen: 8,043 times

Last updated: Oct 03 '12