I followed the recommendations in this thread: http://www.docx4java.org/forums/pptx-java-f14/delete-a-slide-t1070.html
but am getting errors when loading the resulting ppt.
As suggested in the link above, I perform the following steps:
- Code: Select all
MainPresentationPart presentation = ppt.getMainPresentationPart();
Part slidePart = ppt.getParts().get(new PartName("/ppt/slides/slide" + slideNum + ".xml"));
// remove slide from slide list[/color]
SldIdLst sldIdLst = presentation.getJaxbElement().getSldIdLst();
sldIdLst.getSldId().remove(slideNum);
// remove relationship from presentation[/color]
presentation.getRelationshipsPart().removeRelationship(slidePart.getPartName());
// remove part from package[/color]
ppt.getPackage().getParts().remove(slidePart.getPartName());
ppt.getParts().remove(slidePart.getPartName());
Additionally, the last line winds up being redundant as the line before it seems to be completely removing the part (according to the log).
Any ideas what I'm missing here?
Thanks, Folks.
Jim