Java 中的 OpenOffice

发布于 2024-08-07 19:01:24 字数 611 浏览 6 评论 0原文

我需要一个用于 OpenOffice 文档转换的 Java 接口,该接口相当于手册(打开...然后另存为...)以及对 PDF 生成的访问。

以下是我想要实现的一些示例。

1) 在内存中打开一种类型的文档(例如 OpenOffice Writer 文档或 Microsoft Office 文档),并将其保存为另一种支持的格式。

2) 将一种类型的文档打开到内存中并将其导出为 PDF。

我已经浏览了 http://api.openoffice.org 但没有得到任何可以帮助我入门的材料。 我还尝试了 JODConverter 但它要求我将 OpenOffice 作为服务运行。 我更愿意将 OpenOffice 的所有核心功能包含在一个 JAR 文件中,以便用户无需在其 PC 上安装或运行 openoffice 即可使用我的应用程序。

我可以从哪里获取入门教程的 URL/代码片段?

我还必须添加一些 JAR 文件吗? 即使我的 PC 上没有安装 OpenOffice,该应用程序也能运行吗?

I need a Java interface to the OpenOffice document conversion which would equal to a manual (Open... and then Save As...) as well as access to the PDF generation.

The following are some example of what I want to achieve.

1) Open one type of document (fx. OpenOffice Writer document or Microsoft Office document) onto memory and save it in another supported format.

2) Open one type of document into memory and export it as PDF.

I have gone through http://api.openoffice.org but didn't get any material which can help me to get started.
I also tried JODConverter but it requires me to run OpenOffice as a service.
I wold prefer to include all the core functionality of OpenOffice in one JAR file so that that the user can use my application without installing or running openoffice on their PC.

What would be a URL/code snippet from where I can get tutorials to get started?

Also do I have to add some JAR files?
Will the application work even if I don't have OpenOffice installed on my PC?

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

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

发布评论

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

评论(3

人间☆小暴躁 2024-08-14 19:01:24

您可能想看看 noa-libre (Nice Office Access,以前可在 ion.ag 上找到)。它是一个 Java API,包装了 OO.o 的本机 Java API,使其更易于使用。它可以让你快速“远程控制”OO.o。

还告诉我是否需要添加一些罐子?

是的,这是有记录的。

即使我的电脑上没有安装 Open Office,该应用程序也能运行吗?

不,应用程序需要一个正在运行的 (!) OO.o 实例,因为它本质上是远程控制 OO.o。该实例理论上可以在另一台计算机上运行(通过网络控制)。

You might want to have a look at noa-libre (Nice Office Access, formerly available at ion.ag). It's a Java API that wraps OO.o's native Java API to be easier to use. It allows you to quickly "remote control" OO.o.

Also tell me if i have to add some jars?

Yes, that is documented.

Will the application work even if i dont have open office not installed on my pc?

No, the application requires a running (!) instance of OO.o, as it essentially remote-controls OO.o. The instance can in theory run on another computer (controlled via network).

ㄖ落Θ余辉 2024-08-14 19:01:24

尝试 ODF Toolkit 项目 。它有一个 API,允许您操作 openoffice 文档,而无需在客户端计算机上安装 openoffice.org。
这是一篇帮助您开始使用 ODF 工具包的好文章:将 OpenOffice 与 Java 集成,无需安装 OpenOffice< /a>

try the ODF Toolkit project . it has an API that allows you to manipulate openoffice documents without having openoffice.org installed in your client machine.
here is a good article that get you started with ODF toolkit : Integrate OpenOffice with Java without Installing OpenOffice

等风来 2024-08-14 19:01:24

我曾经使用 OpenOffice 将 MS Word 转换为 PDF。虽然它是唯一的免费解决方案,但我对生成的 PDF 文件不太满意,特别是当您的文档具有复杂的 bidi 脚本。

据我所知,对于转换,有两种可能的方法。一种是使用操作系统管道,另一种是套接字或其他东西。我现在没有代码,但您唯一需要做的就是在该 URL 中进行搜索。您应该首先启动一个 OpenOffice 可执行文件(我只是按照 OpenOffice wiki 中的简单教程进行操作)带有一些参数,然后使用提供的 Java 库运行您的 Java 应用程序。

I once used OpenOffice for MS Word to PDF conversion. Although it was the only free solution, I wasn't quite satisfied with the resulting PDF file, specially when your document has complex bidi scripts.

For conversion, as far as I can remember, there was two possible ways. One to use OS pipes and the other was socket or something. I don't have my code right now, but the only thing you need is to search in that URL. You should first launch an OpenOffice executable file (I just followed a simple turorial in OpenOffice wiki) with some parameters, and then run your Java application, using provided Java libraries.

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