OpenOffice calc spreadsheet screenshotThe OpenOffice spreadsheet application, calc, can be extended through plugins to support new functions that can be as easily used in cell formulas as the built-in ones.

Being able to do this using my favourite language, Python, is possible, but not very well documented, so I’ve experimented a bit with it and have come up with a simple example that defines a bunch of new functions that take double and range arguments and return a single value or write back to a defined range. This example can be used as template to write your own plugins and is released under a GPL v2 or greater license.

The example has been developed using OpenOffice 2.4 running on Vista. To build it, you need the OO 2.4 SDK and a MSys environment to comfortably use makefiles and get a decent shell.

The extension file has in it all the needed files to rebuild the example. As the .oxt files are just zipped files you can get them renaming the extension file so it gets a .zip extension and unzipping it.

The makefile has some variables that point to the SDK dir and zip utility that you need to tweak and has the all and install targets build and install the extension.

Addins are composed by:

  • an .idl file to define the interfaces
  • a manifest.xml file to define the extension resources
  • an implementation file

I hope this calc addin example is simple enough to get started. Enjoy!

Click here to download calc addin example: PachiAddin.oxt