- add the new slide to the presentation (you'll need to alter the createSlidePart and/or addSlideIdListEntry method, so your slide is slotted in to MainPresentationPart' at the appropriate place)."
Can you elaborate on what changes I need to make in createSlidePart and/or addSlideIdListEntry. Since I need to insert the new slide in the middle of the an existing powerpoint file, it sounds like I need to iterate through all the slides coming after the insertion point and bump their part names by 1. How will this work with slideLayout's for these slides and other parts related this these slides that get bumped down.
I don't think you'll need to bump their part names.
Using java Syntax Highlighting
public Presentation.
SldIdLst.
SldId addSlideIdListEntry
(SlidePart slidePart
)
throws InvalidFormatException
{
Relationship rel
= this.
addTargetPart(slidePart
);
Presentation.
SldIdLst.
SldId entry
= Context.
getpmlObjectFactory().
createPresentationSldIdLstSldId();
entry.
setId( this.
getSlideId() );
entry.
setRid(rel.
getId());
this.
jaxbElement.
getSldIdLst().
getSldId().
add(entry
);
return entry
;
}
Parsed in 0.016 seconds, using
GeSHi 1.0.8.4
this.jaxbElement.getSldIdLst().getSldId() is a list; just add the entry at your desired position.
Also, in your pseudo code, does cloning the "clone it (use deepCopy method in XmlUtils)" step account for the slideLayout and other elements on the slide being cloned like notes etc. Or do I need to clone these other parts as well and set them on the new slide.
Any rels required by the slide will need to be added (using addTargetPart method). You won't necessarily need to clone the part; slides can point to the same part.
Suggest you run your sample pptx through the PartsList sample to see the rels hierarchy.
hope this helps .. Jason