Managing Python extensions part II

This second part of Python extensions we will run some of the sample extensions in and how some of the more complex code happens in OOo. And how you can work it through.

First we will locate where the Python samples live in and how to get them to run in the OOo.

Running OOo Sample Macros scripting framework support different languages, the menu also coordinate and manage different languages on different options. The Macros item located under Tools will give you options to record macros, execute macros as well as just view the macros acording to a specific language. This can be either:

  • Python
  • Beanshell
  • Javascript

When you select any of this options you get a dialog that filter your macros by the language and just show you the language you got. Once you select the language you can just select the macros and click on execute.

If we want to select the we would do the following:

  1. Select Tools from the main menu
  2. Choose Macros and then decide what to choose
  3. You can select Execute macros and choose between the different macro languages
  4. Or select Organize Macros > Python and just choose between the python macros
  5. On any of the methods you will get a dialog and you will have 3 choices including: My Macros, Macros and the name of the file you are currently open.
  6. We want to select the Macros and you will see HelloWorld, choose it and u will expand it and display HelloWorldPython
  7. Once executed it will insert the legend Hello World (in Python) in your opendocument text.


You can experimenting running other samples:

  • Capitalize – This will change the capitalization of the text
  • MsgBox – This will open a dialog box which will ask for data and return one in exchange of the option
  • pythonSamples – TableSample – createTable – This will generate a document with text, headers and a rich format table populated with numbers and sum formula.

Editing OOo Macros have different ways to edit the macros depending on the language. For OOoBasic includes an internal IDE which is in charge of editing the Macros.
For Javascript it uses the Rhyno Javascript Debugger, this debugger is brought from the mozilla community.


Finally the Beanshell scripts are also done with the Beanshell debugger, for more information check on the website.


Finally our language for this session is Python, which doesn’t has a native IDE and which scripting will not be able to edit within but on external editors. Please look on the previous blog entry to learn about how to install python scripts on