![]() ![]() Make sure to add the statements inside a function. Similarly, for Python, you need to use the following statement to get an object of the running instance of LibreOffice Calc workbook (or Writer document). In earlier examples, I explained the concept of the currentDocument in LibreOffice or StartOffice object model in Basic macro. In the first line, you have to import the uno library. In the Thonny editor, create a file and save it as “HelloWorldCalc.py” to ~/.config/libreoffice/4/user/Scripts/python (for Linux) and C:\Users\\AppData\Roaming\LibreOffice\4\user\Scripts\python for windows. The macro should add a simple “hello world” text to the first cell A1 of the first Sheet of a LibreOffice Calc workbook. Writing your first Python Macroįirstly, I will create a macro in Python for LibreOffice Calc. If you are setting up the first time, the folders “Scripts” and “python” may not exist for the “user-specific” locations. %APPDATA%\LibreOffice\4\user\Scripts\python usr/lib64/libreoffice/share/Scripts/pythonĬ:\Users\\AppData\Roaming\LibreOffice\4\user\Scripts\python ~/.config/libreoffice/4/user/Scripts/python ![]() And the other one is user-specific location, and files are accessible to that user only. One is for the system location, which is common for all users. There are two places where LibreOffice picks up the macro files (i.e.py files). Python macro files location and user profile Proceed to the next step after you install Thonny or any Python editor. Download and Install Thonny (Linux, mac and Windows)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |