18

Does anyone know of any API (commercial or open-source) that can generate/edit PowerPoint 2007/2010 presentations through Java. I have a template in the PowerPoint 2007/2010 format that I require to edit/update. So far I have been converting the .pptx file to xml and then editing and storing it back as .pptx. But the file gets corrupted while opening.

Is anyone aware of any other method or API that do this in Java?

Todd Main
  • 31,359
  • 10
  • 76
  • 141
sreeprasad
  • 229
  • 1
  • 3
  • 4
  • I'm assuming that it *actually* gets corrupted while saving and that you're getting the message when opening. That said, OpenOffice.org is Java based... – Travis Gockel Jan 28 '10 at 06:27

6 Answers6

11

We have done it programmatically (closed source at the moment, sorry) so might be able to help, but beware of a few gotchas.

One is that the POI project (at least when we looked at it last year), was quite incomplete. It didn't do PPTX Charts - which is the one feature we wanted. Infact the POI site may not be upto date, but they don't appear to support PowerPoint 20087 format (http://poi.apache.org/slideshow/index.html). Everybody recommends this project, but our evaluation was that it was pretty much useless for generating PowerPoint 2007 files via Java. Your milage may vary.

Apose also had some significant limitations when we looked at it; not doing Charts in PowerPoint 2007 being the blocking issue for us.

Another issue is that PowerPoint 2007 can be quite buggy. We have had a number of progammatically produced PPT files that caused lock ups, but when testing, we found that we can repro crashes and lock ups with simple PPTX documents created in PowerPoint 2007 - i.e. not our code.

In the end, we did the following: Unpacked a 'template' PowerPoint file to a folder, then on demand, filled the template XML with new values, zipped it up, renaming various elements & delivered it to the user as a valid PPTX. Works OK, other than the odd PowerPoint crash when people edit the file. If there was a market for it, I guess we could package up the code as a webservice (i.e xml/csv -> PPTX) or put together a commerical package, but we wouldn't do it for free.

GrantB
  • 131
  • 1
  • 3
7

docx4j (apache license) now includes a pptx4j component, which can open/edit/save pptx documents.

JasonPlutext
  • 14,472
  • 3
  • 40
  • 78
5

Yes. Check this out http://poi.apache.org/, they just released version 3.6 which now supports Office 2007 format documents. The best part is that it's free!

James
  • 12,060
  • 12
  • 64
  • 102
0

To generate a PowerPoint presentation from a template file, you can use PPT Templates.

This library provides a fluent API to replace variables inside the PPT template:

try(FileOutputStream out = new FileOutputStream("generated.pptx")) {
  new PptMapper()
    .text("variable", "Hello")
    .text("other_variable", "World!")
    .processTemplate(PptTemplateDemo.class.getResourceAsStream("/title.pptx"))
    .write(out);
}

With this library, you can process text and images in the template.

amanteaux
  • 1,288
  • 14
  • 20
0

Another solution that may work for you is Windward Reports (disclaimer, I'm the founder & CEO there). It uses PPTX as one of the supported template formats and merges in data to then generate a PPTX (or PDF, etc.) output.

If the edit/update you need can be handled via the data tags in Windward, this should be trivial for you. If what you need cannot be handled by the tags, then this won't work for you.

David Thielen
  • 22,779
  • 27
  • 83
  • 163
0

Well as mentioned by GrantB best way is to create a template, then load the template , traverse the xml graph,update the data and stream out to a output ppt. We recently did it to generate reports for clients that had complex visuals and charts in ppt. You can have a look here generate ppt in java

sayannayas
  • 734
  • 9
  • 15