关于PowerPoint的Java解决方案

在找一些Java操作PPT文档的资料,得到这样一些信息:
- POI(hslf)对PPT的支持还在开发之中,目前尚未发布任何版本包括测试版。可以通过apache的版本控制系统获取到正在开发中的代码,不知道能用否;
- 搜索引擎查到最多的是一个商业版本——TonicPoint Builder (http://tonicsystems.com/products/builder/),提供DEMO版,等填完资料后告诉你说两天后答复你;
- 使用jawin(http://jawinproject.sourceforge.net/),这是一个开源的项目,只是它的工作原理是利用JNI调用OLE来操控PowerPoint,因此要求机器必须是Windows系统,且要装有PowerPoint,不是纯java的解决方案。
Here's the code to load and export a PowerPoint presentation (with strPowerPoint as the path to the PowerPoint presentation and strOutputDir as the path to a directory in which to dump the images):
Ole32.CoInitialize(); DispatchPtr app = new DispatchPtr("PowerPoint.Application"); DispatchPtr preses = app.getObject("Presentations"); DispatchPtr pres = (DispatchPtr) preses.invoke("open", strPowerPoint, new Integer(0), new Integer(0), Boolean.FALSE); pres.invoke("Export", strOutputDir, "PNG"); pres.invoke("Close"); app.invoke("Quit"); Ole32.CoUninitialize();
The code was based on a Jawin example. Obviously, this would be really painful for any significant amount of COM interaction, but for a quick-and-dirty task like this, it's pretty sweet.
继续搜寻中......或者等TonicPoint Builder把demo版发过来看能否破解之。如果不行,最后一种应该是最合适的方案。
The application PowerPoint is presentation software and a part of Microsoft Office. Its native file format has a file extension of .ppt
. This page lists Java software to read and write PPT files.
Library / package | License | Description |
---|---|---|
Davisor Offisor | Commercial | Read Powerpoint (PPT) files. Can convert them to XML. 100% Java. |
POI | Apache Software License 1.1 | Read and write Microsoft OLE 2 compound document format files. This includes MS Office files (DOC, XLS, PPT) written with Office versions that were released after 1997. |
Tonic Java PowerPoint Library | Commercial, demo available | Read, create and manipulate PowerPoint files. 100% Java. Also available is a free Java reader for PPT files. |