有什么方法可以将 Open Office 嵌入到我的应用程序中吗?
我通过 UNO 成功使用 Open Office。现在我想将 Open Office 库嵌入到我的 Java 应用程序中,可以吗?
I am successful in working with Open Office via UNO. Now I want to embed the Open Office library into my Java application, is it possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,你可以。您需要 OpenOffice SDK。
查找示例此处:(您会看到它讲述了 StarOffice SDK,但它是相同的,请记住 StarOffice 是只是 Sun 品牌的 OpenOffice.org 版本,添加了商业字体和剪贴画)
如果您只想从 Java 应用程序操作 ODF 文件而不实际加载 openoffice.org,检查此库。
FC
Yes you can. You need the OpenOffice SDK.
Find examples here: (you'll see it speaks about the StarOffice SDK but it's the same, remember StarOffice was just the Sun-branded build of OpenOffice.org with the addition of commercial fonts and clip-art)
If you just want to manipulate ODF files from a Java app without actually loading up openoffice.org, check this lib.
FC
我有类似的问题。我在 使用桌面 中找到了一些文档="https://wiki.openoffice.org/wiki/Documentation/DevGuide" rel="nofollow">Apache OpenOffice 开发人员指南。关于 StarSuite 示例的兼容性,也许某些 StarSuite 示例是可行的?该指南提到了一个问题,“StarOffice 5.x 中 OpenOffice.org GUI 的重新设计”。。
本指南的示例使用 UNO 开发工具包 在 StarSuite Basic 和 Java 中交替提供。开发人员指南前面还提供了一个方便的教程。 UNO IDL 在编写 UNO 组件< /a>. UNO 组件模型可能看起来与 OMG CORBA 或 Microsoft 的 COM 类似——我不知道它如何在 C# 中进行接口。
未能找到问题的确切解决方案,以下内容代表了我的“最佳猜测” “如何”。
虽然我无法找到任何关于在外部 Java 应用程序中嵌入 OpenOffice 组件的确切文档,但是 - 对于 UNO API 的视图 - 引用 使用桌面一文,有一个 UNO 界面,XFrame,引入。 XFrame 接口发布了一个方法, getComponentWindow 此外 - 返回 ::com::sun::star::awt::XWindow,UNO IDL 接口。当然,在XWindow发布的接口方法中,我没有看到任何获取本机窗口对象的方法。当然,会有一个本机窗口对象,可以在应用程序的某个位置访问。就我个人而言,我并不是立即熟悉 OpenOffice 源代码树。
如果将应用程序作为扩展嵌入到 OpenOffice 中,或者将 OpenOffice 嵌入到应用程序中,也许这可能是一个更简单的任务?关于扩展 OpenOffice,DZone 上有一个教程,OpenOffice.org 可以多快是否要扩展?另外,“首次接触”教程 提供一些附加信息(如果是为了扩展 OpenOffice)。在后者中,作者使用 Ant 进行构建过程。当然,如果需要的话,可以很容易地转换为使用 Apache Maven,例如在类似方面应用 Maven 的 JAR 构建器。
HTH
I had a similar question. I've found some documentation about Using the Desktop in the Apache OpenOffice Developer's Guide. With regards to compatibility of examples from StarOffice, perhaps some of the StarOffice examples would be viable? The guide mentions a certain matter, a "redesign of the OpenOffice.org GUI in StarOffice 5.x".
The guide's examples are provided alternately in StarOffice Basic and in Java, in using the UNO Development Kit. There's also a convenient tutorial, earlier in the Developer's Guide. UNO IDL is introduced under the section, Writing UNO Components. The UNO component model perhaps might seem similar to OMG CORBA or Microsoft's COM -- I'm not aware of how it might be interfaced in C#
Failing to find an exact solution to the question, the following represents my "Best guess" as far as "how to".
Though I've been unable to find any exacting items of documentation if towards embedding an OpenOffice component within an external Java application, but -- towards a view of the UNO API -- referencing the Using the Desktop article, there's an UNO interface, XFrame, introduced. The XFrame interface publishes a method, getComponentWindow moreover - returning an object of type ::com::sun::star::awt::XWindow, an UNO IDL interface. Sure, in the interface methods published by XWindow, I don't see any methods for obtaining a native window object. Of course, there would be a native window object, accessed somewhere in the application. Personally, I'm not immediately familiar with the OpenOffice source tree.
Perhaps it may be a simpler task, if to embed an application as an extension within OpenOffice, alternate to embedding OpenOffice within an application? Towards extending OpenOffice, there's a tutorial at DZone, How Fast Can OpenOffice.org Be Extended? Also, the "First contact" tutorial provides some additional information, if towards extending OpenOffice. In the latter, the author is using Ant for the build process. Surely that would be easy enough to convert to use Apache Maven, if needed, such as to apply Maven's JAR builder in a similar regards.
HTH