Latest Posts

Getting Started with LibreOffice Calc and Python

Let’s get started with LibreOffice Calc & Python programming: Software LibreOffice You will of course need LibreOffice, you can download the latest version here.LibreOffice is shipped with a PyUNO bridge. This bridge binds its components with the Python language. It…
Read more

Embedding vs. Storing Python Macros in LibreOffice

This article helps you decide whether to embed your python macro in the file. It also explores saving it in a macro repository. With the APSO add-on (see previous article) you can embed your macro within the LibreOffice File. This…
Read more

Create Documents from Templates Using Python in LibreOffice

Let’s start with the full code, then dive down First we need to import the uno library and the specific PropertyValue function Then let’s set the couple of service definitions that we need: We create 3 functions: create_instance: new_document_from_template: This…
Read more

What is getDesktop () ?

Usually the first statement, when scripting with python to work on a LibreOffice document, would be:desktop = XSCRIPTCONTEXT.getDesktop() getDesktop() is a method of the object XSCRIPTCONTEXT and returns the Desktop Reference on which our script can interact with. This reference…
Read more

What is XSCRIPTCONTEXT ?

When you program a script within LibreOffice, accessing the XSCRIPTCONTEXT object is the starting point for controlling LibreOffice documents. SCRIPTCONTEXT is an object of class ‘pythonscript.ScriptContext’.This object provides connections with running instances of LibreOffice and has four useful methods:getDocument ()getInvocationContext…
Read more