Using OpenOffice API to convert Excel files
By sebsto on août 18, 2008
Excel files are always a bit tricky to handle when you're not developping nor deploying on Windows servers (if you are using Windows, then check out our DCOM Binding Components as it might be an elegant way to handle DCOM compliant objects from OpenESB - or - our DCOM OTD for the folks using Java CAPS repository-based projects)
The solution I choose to handle these files is quite simple : I am using the OpenOffice API to programmatically open the XLS file with OO and save it as a CSV text file ... just like you would do it by hand, using the OO GUI.
For this sample to compile and execute, you will need a couple of OO jar files in your classpath (see the code sample for the exact list of required jars, they are all shipping with OpenOffice) and you will need to start OpenOffice in background mode, listening to network invocations from your client program (the exact command is given in the code sample).
As usual, your comments and feebacks are welcome.