开发者

are there any ways to embed Open Office into my application?

I am successful in working with Open Office via UNO. Now I want to embed the 开发者_Python百科Open Office library into my Java application, is it possible?


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜