Ask Your Question
1

Detailed tutorial regarding LibreOffice to Python macro writing, especially for Calc

asked 2015-04-11 17:07:48 +0200

plrrrrr gravatar image

I've google a bit I came empty. A lot of bits and pieces but nothing detailed and to the point that explains everything from setup to the API and to the why. Most of it expect intimate knowledge of LibreOffice API.

I am not a programmer, I only dabble in this. Are there any resources out there that are not for helping people that don't need help?

edit retag flag offensive close merge delete

Comments

You sure it must be Python? Ok, We may be near to the crest of the Python wave. We had a Java wave, too, which may have reach the beach meanwhile. Now and then there will be a version upgrade of Python. It seems an update of the uno-bridge may then also be needed. Will the Python people do it? BASIC may be a rather outdated language and the StarBASIC IDE is not state of the art, there are less "nice tools" ...

But StarBASIC is the programming tool LibreOffice comes with.

Lupp gravatar imageLupp ( 2015-04-12 12:29:53 +0200 )edit

If StarBASIC one day will be replaced there should be hope that the LibreOffice team will also mind the transition/conversion ...

I don't actually know Python, and I'm using StarBASIC very limited. But if there should be need of custom programming I would firts try BASIC to come to a solution.

Lupp gravatar imageLupp ( 2015-04-12 13:00:24 +0200 )edit

@Lupp: IHMO youre wrong, its not about waves, hype's whatever...python still exist 25 Years -- that, with respect, is in terms of IT a very long time, and its importance results from stable and robust development* and not because of some kind being "the latest craze"...

*other reasons may be: Easy to learn, easy to test, ..to develop, excellent Documentation, lot of ready to use third party stuff....

karolus gravatar imagekarolus ( 2015-04-12 17:20:26 +0200 )edit

@karolus Yes! Python seems to be matured - and I already confessed that I don't know more about it, except that I read and tried to understand a few code snippets published here and in the OpenOffice forum, some of them contributed by you. There I also made an observation: More than one times somebody (you again among them) suspected a Python upgrade to be the reason of a broken custom routine. I really don't like BASIC. For the very little programming I do in LibO I'll stick to it nonetheless.

Lupp gravatar imageLupp ( 2015-04-12 17:36:26 +0200 )edit

I am looking for Python because 1) I am somewhat familiar with it and 2) I don't want to learn LibreOffice Basic just for LibreOffice scripts.

plrrrrr gravatar imageplrrrrr ( 2015-04-12 20:26:17 +0200 )edit

5 Answers

Sort by » oldest newest most voted
2

answered 2015-12-06 19:53:20 +0200

Christopher5106 gravatar image
edit flag offensive delete link more

Comments

Yes, this is by far the best tutorial on Python macros in LibreOffice, and it should be given more prominence in the official documentation. I can recommend it wholeheartedly to anyone who needs to start programming LibreOffice with Python macros. Thank you for writing this.

steko gravatar imagesteko ( 2016-04-18 13:44:32 +0200 )edit

Thank you! This looks very promising :)

houseisfun gravatar imagehouseisfun ( 2016-08-07 12:01:15 +0200 )edit
1

answered 2017-08-12 06:46:57 +0200

pysb gravatar image

I made two libreoffice macros on python to rename and delete files. I hope It helps. Here is the link: https://github.com/albcunha/libreoffice_macros

edit flag offensive delete link more
1

answered 2017-02-02 14:24:07 +0200

Jannie T gravatar image

I was frustrated about the same thing as the OP, so made the time to publish my journey notes here: https://onesheep.org/scripting-libreo...

edit flag offensive delete link more

Comments

@Jannie T: some nice points ;-) …

please correct the missing Indentation in dev.py and generally please follow the strong Convention of exactly four spaces per Indentation-level.

Have a look my answer in this thread

karolus gravatar imagekarolus ( 2017-02-02 15:18:11 +0200 )edit
0

answered 2015-04-12 18:04:09 +0200

karolus gravatar image

Hallo!
How to start?
Currently your on the Stage:

  • no programming skills
  • no skills about this huge 200 MB Program nor its complicated Api

I'm only can give some advice: Start learning Python independent from Libreffice. at some day in the Future you will be able to work with the "pieces spread over the web"

some links:
tuturial
Start
not so hard as it looks
best available answer ;-)

edit flag offensive delete link more

Comments

I do know Python loosely speaking. However, I have not found anything specific regarding Python used in conjunction to LibreOffice. Knowing Python can't make it read LibreOffice sheets in its particular format can it?

plrrrrr gravatar imageplrrrrr ( 2015-04-12 20:25:03 +0200 )edit

Of Course with python you can also read|write .odf in general inclusive .ods in detail without any soffice at hand.
this thirdparty-tool

karolus gravatar imagekarolus ( 2015-04-12 22:15:33 +0200 )edit
0

answered 2015-07-09 10:16:58 +0200

eelco gravatar image
edit flag offensive delete link more

Comments

You link provide no new informations, the HelloWorld-example is already included in ...libreoffice/share/Scripts/python/...

karolus gravatar imagekarolus ( 2015-07-09 11:16:48 +0200 )edit

this is a good example and exemplifies my impression that the LibreOffice flavor of Python is fairly unPythonic dialect of Java. Would help to have a reference of what are the major objects/methods to invoke to get started, the equivalent in LO Basic of ThisComponentThisDatabaseDocument and dbg_methods, etc.

doug gravatar imagedoug ( 2015-07-10 02:55:22 +0200 )edit
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2015-04-11 17:07:48 +0200

Seen: 22,479 times

Last updated: Aug 12