I'm new to both Java programming as well as pptx4j.
So please forgive me if this question is a trivial one.
I used the code generator to generate a table I made in the form of a JAXBElement object.
Now, how do I add this object to my slide?
This is what I was trying to do:
- Code: Select all
PresentationMLPackage presentationMLPackage = PresentationMLPackage.createPackage();
MainPresentationPart pp = (MainPresentationPart)presentationMLPackage.getParts().getParts().get(new PartName("/ppt/presentation.xml"));
SlideLayoutPart layoutPart = (SlideLayoutPart)presentationMLPackage.getParts().getParts().get(new PartName("/ppt/slideLayouts/slideLayout1.xml"));
SlidePart slidePart = presentationMLPackage.createSlidePart(pp, layoutPart, new PartName("/ppt/slides/slide1.xml"));
slidePart.getJaxbElement().getCSld().getSpTree().getSpOrGrpSpOrGraphicFrame().add(createIt());
But I get the following error:
[com.sun.istack.internal.SAXException2: Instance of "javax.xml.bind.JAXBElement" is substituting "java.lang.Object", but "javax.xml.bind.JAXBElement" is bound to an anonymous type.]