get/manipulate individual slides
Posted: Thu Sep 22, 2011 2:59 am
How to get the reference to xml for each slide so that i can use my own logic to manipulate those xmls. suppose, my pptx has three slides, so i will be having three xmls /ppt/slides/slide1.xml, ..2.xml and ..3.xml. I had written a code
I had seen code snippets like
But I have multiple xmls to be processed.( as there are multiple slides) .
- Code: Select all
PresentationMLPackage pMlPackage = PresentationMLPackage.load(new File("C:/simple.pptx"));
Parts parts = pMlPackage.getParts();
Map<PartName,Part> allPartsMap = parts.getParts();
for(PartName partName:allPartsMap.keySet())
{
if(partName.getName().contains("/ppt/slides/"))
{
SlidePart slidePart = (SlidePart)allPartsMap.get(partName);
// here i want to get the xmls to be loaded for manipulation
//Document doc = XmlUtils.marshaltoW3CDomDocument(slidePart.getJaxbElement());
}
}
pMlPackage.save(new File("C:/simple_out.pptx"));
I had seen code snippets like
- Code: Select all
Object obj = XmlUtils.unmarshallFromTemplate(xml, mappings);
//change JaxbElement
documentPart.setJaxbElement(obj);
SaveToZipFile saver = new SaveToZipFile(wordMLPackage);
//save new documnt
saver.save(newFile);
But I have multiple xmls to be processed.( as there are multiple slides) .