Page 1 of 1

powerpoint in Java = pptx4j

PostPosted: Thu Nov 12, 2009 10:51 am
by jason
I'm considering creating support for pptx PresentationML, either as a separate project (pptx4j), or within docx4j (/src/pptx4j).

Either way, it would be dependent on docx4j, since docx4j contains the openpackaging stuff, and support for drawingML, and I don't propose to move or rename that stuff.

What I'd like to know is, would this be of interest - either to people already working with docx4j, or to people who need to work with pptx files but not docx files?

You can already do stuff with pptx using POI, so I guess this would be of most interest to people who want a JAXB based approach, or are already using docx4j.

cheers

Jason

Re: powerpoint in Java = pptx4j

PostPosted: Tue Jan 19, 2010 11:21 am
by jason
As of changeset 1044, docx4j can load and save OpenXML PresentationML packages.

Loading a pptx is as simple as:
Code: Select all
PresentationMLPackage presentationMLPackage = PresentationMLPackage.load(file);   

Saving is:
Code: Select all
presentationMLPackage.save(file);

Using the same approach as for docx documents, it represents each part as a JAXB content tree.

To create a "Hello World" presentation, see http://dev.plutext.org/trac/docx4j/brow ... 4j/samples

All the code you need is in docx4j (docx4j-nightly-20100118.jar). (If building from source, you'll now need to add src/pptx4j/java to your path.)

See also the docx4j Getting Started guide, available at http://dev.plutext.org/svn/docx4j/trunk/docx4j/docs/

You should be aware that although the loading (and saving) of parts ought to be quite robust (since this uses underlying docx4j), the JAXB representation of PresentationML is new. As such, we're still to change the names of various common elements from eg CTCommonSlideData to CommonSlideData. So right now, this is for early adopters only.

I'm interested of course to hear how you'd like to use pptx4j - please post to the new pptx4j forum. Code contributions are also welcome!

For my part, my interest is in converting DrawingML (and VML) to SVG, and back again.

Re: powerpoint in Java = pptx4j

PostPosted: Fri Jan 22, 2010 9:40 pm
by Ranger
Hello Jason,

thanks a lot for your good work. docx4j is easy to use and I like it.

I think pptx4j should be a separate project, because docx4j has at the moment too much dependencies and pptx4j makes it not better.

What do you think about my proposal to split the project in 3 projects.
1. Project with the core functionality
2. docx4j (include core-project)
3. pptx4j (include core-project)

Can you set the scope for junit in the next release, please?
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
<scope>test</scope>
</dependency>

thanks
Ranger

Re: powerpoint in Java = pptx4j

PostPosted: Wed Jan 27, 2010 10:08 am
by jason
Hi Roger, thanks for your thoughts.

I'm aware that docx4j has too many dependencies. The forthcoming v3 release will reduce this - there's an earlier post on this iirc.

The main effect of including powerpoint stuff in docx4j is the inclusion of generated classes for PresentationML. This does add several hundred kb. (But the overall weight of v3 - including dependencies - will be significantly lower). It would probably be worth ensuring you can build docx4j without src/pptx4j/java, so you can trim the kb; there are a few places where minor code changes would be required for this.

As to the overall layout of the project. If I was starting from scratch, I'd name the org.docx4j.openpackaging package differently, since that is used for both docx and pptx (perhaps org.plutext.opc?). Similarly with dml and some of the other JAXB contexts. But I'm not planning to rename any of this, since that would cause a headache for every existing user.

cheers .. Jason