X

Geertjan's Blog

  • February 14, 2007

Hello OpenOffice.org API

Geertjan Wielenga
Product Manager
Many many moons ago (which turns out to be June 16, 2006), Wouter van Reeven (from Amis in Holland) and I started writing a tutorial for OpenOffice.org API on the NetBeans Platform. Wouter provided the OpenOffice.org API side of the story and I provided the NetBeans Platform side. That was a pretty cool document we worked on and we intended to try to publish it somewhere externally. However, the story kind of dwindled at some stage, because it became quite difficult to provide a solid bootstrapping story. There were problems with classloading, there were problems with native libraries, and there were problems even understanding what exactly the problems were. So, even though the story was complete and the tutorial written, it never got publicized on netbeans.org or anywhere else.

However, in the meantime we have OpenOffice NetBeans Integration. One of the project templates that this integration provides (i.e., installed via an NBM file in NetBeans IDE) is called "Open Office Client Application Project Type". I used that and, without much problem, worked the original code of Wouter and my tutorial into this Java application project (i.e., not a NetBeans module suite, or rich-client application, or module, but just a plain old Java application). The downside is that you need to specify the OpenOffice SDK and local installation before you even begin working with these project types, and these are registered in a project-level file called project-uno.properties. I wonder what this means for distribution? Does this mean that the end user has to have the SDK installed locally? That's part of the bootstrapping issue we had when working with NetBeans modules and OpenOffice.org API. Anyway, the long and short of it is that the tutorial, slightly reworked for the Java application context (i.e., now I'm using a JFrame instead of a TopComponent and the bootstrapping is slightly different), is that you can produce reports like this one:

When you click the Generate Report button, you get a spreadsheet that has a number of cool features, such as rows that have alternating colors (white/orange), a special color (green) for the row with the highest number of replies, another special color (red) for the row with the lowest number of replies, and additional cells specifying the authors of the highest/lowest replied-to article. Full code for this scenario is in the tutorial worked on by Wouter and myself, which is An Introduction to the OpenOffice.org API.

Join the discussion

Comments ( 3 )
  • Juergen Schmidt Thursday, February 15, 2007
    Hi Geertjan, the plugin will still require an OO.org installation and a SDK but the settings are not longer stored in the project-uno.properties in the next version. So the generated projects become more flexible. But of course if you want to compile this projects you will need the plugin and the plugin requires the office and the SDK. We will also improve the UNO project specific ant scripts to be more flexible. Any kind of help or tips are welcome ;-) More nice features are coming also (Java macros development, support for NetBeans suite projects, ...)
  • Juergen Schmidt Thursday, February 15, 2007
    One further info i forgot. The generated Java client applications need only a default installed OpenOffice.org (no SDK at runtime) on the system. The bootstrap mechanism searched the default office, prepares an own classloader and everything else should work then out of the box. As i mentioned earlier, we plan to provide a UNO or office core nbm to support it in NetBeans suite applications as well.
  • Geertjan Thursday, February 15, 2007
    Wow, sounds great. Can't wait for the module suite support! That will be absolutely fantastic. By the way, we call NetBeans suite applications "NetBeans Platform applications" or "rich-client applications on the NetBeans Platform". Because that's what they are -- rich-clients, built on the NetBeans Platform. Would be wonderful to have OpenOffice.org API tightly easily accessible from these kind of applications.
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.