Page 1 of 1

docx4j and pptx4j differences

PostPosted: Thu Sep 22, 2011 2:59 am
by sanmoy
Hi,

I want to extract the slide xml from the pptx files and replace the texts. I had done it for docx and xlsx with apache poi but poi has a very limited support for pptx. My first problem is, I cannot typecast org.pptx4j.pml.Sld to org.docx4j.wml.Document.
Code: Select all
org.docx4j.openpackaging.parts.PresentationML.SlidePart slidePart = (SlidePart) allPartsMap.get(partName);
org.docx4j.wml.Document wmlDocument = (org.docx4j.wml.Document)slidePart.getJaxbElement();
// as
public final class SlidePart extends JaxbPmlPart<Sld>

I need the xml representation for marshalling and unmarshalling. The same operation is possible for documentPart
Code: Select all
MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();
(org.docx4j.wml.Document) documentPart.getJaxbElement();
//as
public abstract class DocumentPart<E> extends JaxbXmlPart<E>

Why this difference is there in pptx4j and docx4j ?

Re: docx4j and pptx4j differences

PostPosted: Thu Sep 22, 2011 9:49 pm
by jason
docx and pptx both use the open packaging format, so docx4j and pptx4j share this code.

However, WML and PML are distinct xml schemas (XSD), so org.docx4j.wml.Document and org.pptx4j.pml.Sld are not interchangeable.

That said, both docx4j and pptx4j use JAXB to marshal/unmarshall the contents of each "part".