将 Java UNO 代码从 OpenOffice 2.4 迁移到 3.0
我编写了一个漂亮的小工具,用于将电子表格转换为纯文本。 由于它是我的私人黑客工具,因此它依赖 OpenOffice 2.x 来读取文件。
但是,当我安装 OpenOffice 3 并尝试让它运行时,我惨遭失败,因为我要么丢失了一些 JAR 文件,要么一半的类已被替换。
我包括来自 URE/Java 的所有五个 JAR 文件(URE:UNO 运行时环境,OpenOffice.org 托管的子集和 管理 UNO 组件),但我仍然缺少这些类:
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
有什么指示吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了我所缺少的东西。
我必须包含以下 jars
我之前丢失的最后一个 - 注意德语 OOo 版本。
而且,我以前不必做的事情是,我必须包含 OOo 可执行文件的路径,例如,
之后并且无需更改代码,它就可以像以前一样工作。
所以,Brian,UNO 的 API 即使在主要版本之间也是稳定的。 这只是我必须修复的类路径。
I found what I was missing.
I had to include the following jars
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, e.g.
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.