Supported Languages for LibreOffice Macros
LibreOffice offers robust automation capabilities through its built-in macro engine, allowing users to automate repetitive tasks and extend application functionality. The office suite natively supports four primary scripting languages: LibreOffice Basic, Python, BeanShell, and JavaScript. Additionally, through its Universal Network Objects (UNO) component model, developers can interact with LibreOffice using external languages such as C++ and Java.
1. LibreOffice Basic
LibreOffice Basic is the default and most commonly used language for writing macros. It features an integrated development environment (IDE) built directly into LibreOffice, which includes syntax highlighting, a debugger, and variable inspection tools. It is syntactically similar to Microsoft Visual Basic for Applications (VBA), making it accessible for users migrating from other office suites.
2. Python
Python is a powerful, modern language supported natively in LibreOffice. It is ideal for complex automation, data processing, and integration with third-party libraries. While LibreOffice does not include a dedicated built-in IDE for Python, scripts can be written in any external editor and executed within the office suite using the internal Python runtime or through external socket connections.
3. BeanShell
BeanShell is a lightweight, Java-compatible scripting language that executes directly within the Java Runtime Environment (JRE). It allows developers to write macros using Java syntax without the need to compile code beforehand, providing an easy entry point for Java developers working with LibreOffice.
4. JavaScript
LibreOffice includes a JavaScript scripting engine powered by Mozilla Rhino. It enables developers to automate documents using standard JavaScript syntax, executing scripts within the document or application environment.
External Languages via the UNO Bridge
Beyond internal scripting, LibreOffice’s functionality is exposed through the Universal Network Objects (UNO) interface. This architecture allows developers to control LibreOffice headlessly or as a separate process using fully compiled external languages, including: * Java * C++ * C# / .NET (via the CLI-UNO bridge)
These external options are commonly used for standalone software, server-side document conversion, and enterprise-grade application integrations.