Ask Your Question
0

Programming LibreOffice ver 5.4.3.2

asked 2017-12-16 16:09:54 +0200

cve60069 gravatar image

I have downloaded the Beta version of LibreOffice and I could not contain my excitement when I saw the opportunity to program my documents using Javascript and Python. Problem is, I do not know how to "attach" my code to the document (in Excel, I right-click on a tab and choose view-code).

I saw somewhere that I need to download the SDK. Is this correct. I basically want to use Javascript or Python in a similar way that I use VBA in excel. I have a very good stand-alone Javascript editor.

Any pointers on where to start my learning-curve would be appreciated. e.g. "Hello World" in a calc-document using Javascript would be good.

Regards

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2017-12-17 07:16:05 +0200

Jim K gravatar image

Generally, Python is the preferred choice for LibreOffice macros.

To facilitate creating Python macros, install the APSO extension. This provides a dialog at Tools -> Macros -> Organize Python scripts. For example, expand "My Macros" and go to the popup Menu -> Create Module.

A good introductory Python/LibreOffice tutorial is at http://christopher5106.github.io/offi....

For additional information, one page that I have found beneficial is https://wiki.openoffice.org/wiki/Pyth.... But many other pages could be suggested as well.

In contrast, Javascript support in LibreOffice is buggy and not recommended. However, if you really want Javascript Hello World for Calc then post a separate question and we can explain how.

There is no need to install the SDK for macro programming. The SDK is for writing components in languages such as Java and C++. Java is a useful language for working with LibreOffice as well, but it is not analogous to VBA in Excel.

edit flag offensive delete link more

Comments

Nice pointers indeed. Also interesting might be the MRI - UNO Object Inspection Tool, for documentation see RunMRI · hanya/MRI Wiki · GitHub.

erAck gravatar imageerAck ( 2017-12-17 18:28:20 +0200 )edit

Thanks for the advice and good information. I was keen to link my spreadsheets to a browser, hence Javascript but as I have never used Python, I shall have fun trying the language out.

Regards

cve60069 gravatar imagecve60069 ( 2017-12-18 14:16:45 +0200 )edit

If this answer was useful, then please mark it correct as described under guidelines for asking. That should give you some reputation points. It also gives me some points and, most importantly, it closes out the question.

Jim K gravatar imageJim K ( 2017-12-18 20:02:29 +0200 )edit

If you need help working with the web from a Python macro, feel free to post another question. There are several people who are on this site daily and are experienced with Python macros.

Jim K gravatar imageJim K ( 2017-12-18 20:09:16 +0200 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2017-12-16 16:09:54 +0200

Seen: 836 times

Last updated: Dec 17 '17