简体   繁体   中英

Migrating Java UNO code from OpenOffice 2.4 to 3.0

I had a nifty small tool written to convert spreadsheets to plain text. Since it was my private hacker tool, it relied on OpenOffice 2.x to read the files.

But when I installed OpenOffice 3 and tried to get it get it to run, I failed miserably, because I'm either missing some JAR files or half the classes have been replaced.

I'm including all five JAR files from URE/Java (URE: UNO Runtime Environment, a subset of OpenOffice.org hosting and managing UNO components) and am still missing these classes:

com.sun.star.frame.XComponentLoader
com.sun.star.frame.XController
com.sun.star.frame.XDesktop
com.sun.star.frame.XModel
com.sun.star.frame.XStorable
com.sun.star.sheet.XSpreadsheet
com.sun.star.sheet.XSpreadsheetDocument
com.sun.star.sheet.XSpreadsheetView
com.sun.star.text.XTextDocument

Any pointers?

I found what I was missing.

I had to include the following jars

URE/java/juh.jar
URE/java/jurt.jar
URE/java/ridl.jar
Basis/program/classes/unoil.jar  

The last one I was missing before - note the German OOo version .

And, something I didn't have to do before, I had to include the path to the OOo executables, eg

c:/program/OpenOffice.org 3/program/

After that and without changing code it worked just like before.

So, Brian, UNO's API is stable even between major releases. It was just the classpath I had to fix.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM