将 Java UNO 代码从 OpenOffice 2.4 迁移到 3.0

发布于 2024-07-07 12:58:31 字数 685 浏览 10 评论 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

温柔嚣张 2024-07-14 12:58:31

我找到了我所缺少的东西。

我必须包含以下 jars

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

我之前丢失的最后一个 - 注意德语 OOo 版本

而且,我以前不必做的事情是,我必须包含 OOo 可执行文件的路径,例如,

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

之后并且无需更改代码,它就可以像以前一样工作。

所以,Brian,UNO 的 API 即使在主要版本之间也是稳定的。 这只是我必须修复的类路径。

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, e.g.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文