Java + OpenOffice,互操作自动化真的这么难吗?

发布于 2024-09-17 11:46:56 字数 590 浏览 2 评论 0原文

我正在尝试用 Java 重写我的 C# 应用程序。我选择 Java 是因为我们的目标平台现在是 Linux,不再是 Windows。

我的 C# 应用程序使用 Microsoft Office Interop 来自动化 Word 和 Excel 等内容。它只会打开不同的文档并对它们应用我们的格式(调整列宽、删除斜体等)。最后,它会将文档另存为 PDF。

既然我们的目标是 Java 和 Linux,并且知道 OpenOffice 可以完成所有这些事情,我认为这将是一个平稳的过渡。 OpenOffice是开源的,那么它一定有一个比较漂亮的自动化界面吧?

我整个上午都在谷歌搜索和查看文档。我已经下载了 OpenOffice SDK。我已按照涉及安装 MinGW 和 Zip 工具包的说明进行操作。我尝试过 NetBeans 插件和 Eclipse 配置设置。

有趣的是,我什至不确定我的方向是否正确。我一直在阅读有关 OpenOffice UDO 界面的内容,但这听起来更像是 OpenOffice 脚本,例如 VBA 之类的。

有谁知道是否有某种导入可以让我使用 OpenOffice 打开和操作文档,类似于 Office 的互操作库?如果是这样,知道最近有什么例子或博客文章等吗?

I'm trying to re-write a C# application of mine in Java. I've chosen Java because our target platform is now Linux, no longer Windows.

My C# application used Microsoft Office Interop to automate things like Word and Excel. It would simply open different documents and apply our formatting to them (adjust column width, remove italics, etc). Finally, it would save the documents as PDF.

Now that we are targeting Java and Linux, and knowing that OpenOffice can do all of these things, I figured it would be a smooth transition. OpenOffice is open source, so it must have a relatively nice automation interface, right?

I've been Google'ing and looking at docs all morning. I've downloaded the OpenOffice SDK. I've followed instructions involving installing MinGW and a Zip toolkit. I've tried NetBeans plugins and Eclipse configuration settings.

The funny thing is, I'm not even sure if I'm in the right direction. I've been reading about OpenOffice UDO interface, but that sounds more like in-OpenOffice Scripts, like VBA or something.

Does anyone know if there's simply some sort of import that allows me to use OpenOffice to open and manipulate documents, similar to Office's Interop libraries? If so, know of any recent examples or blog posts, etc?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

ゞ记忆︶ㄣ 2024-09-24 11:46:56

是的,OpenOffice jar 文件本身(来自应用程序)就是 SDK。接口涉及调用其中的方法。一旦你弄清楚了,这并不难,但我同意,它的文档相当薄弱。它肯定是由知道如何做的人编写的,并且可以将其用作参考,但不擅长向其他人解释它。 :-)

Yes, the OpenOffice jar files themselves (from the app) are the SDK. The interface involves calling methods in them. It's not hard once you figure it out, but I agree, documentation for it is pretty weak. It was definitely written by people that know how to do it, and can use it as a reference, but aren't any good at explaining it to others. :-)

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