https://bz.apache.org/bugzilla/show_bug.cgi?id=60042
Bug ID: 60042
Summary: PartAlreadyExistsException thrown when removing and
adding slides.
Product: POI
Version: 3.14-FINAL
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: XSLF
Assignee: [email protected]
Reporter: [email protected]
Created attachment 34172
--> https://bz.apache.org/bugzilla/attachment.cgi?id=34172&action=edit
Presentation file which triggers the bug when used with the code in the
description.
I have a use case which requires taking a template presentation, deleting some
slides, and adding some more. When doing this, I get the following error
message when attempting to add a new slide after removing an old one:
Exception in thread "main"
org.apache.poi.openxml4j.exceptions.PartAlreadyExistsException: A part with the
name '/ppt/slides/slide2.xml' already exists : Packages shall not contain
equivalent part names and package implementers shall neither create nor
recognize packages with equivalent part names. [M1.12]
at org.apache.poi.openxml4j.opc.OPCPackage.createPart(OPCPackage.java:811)
at org.apache.poi.openxml4j.opc.OPCPackage.createPart(OPCPackage.java:775)
at
org.apache.poi.POIXMLDocumentPart.createRelationship(POIXMLDocumentPart.java:536)
at
org.apache.poi.xslf.usermodel.XMLSlideShow.createSlide(XMLSlideShow.java:220)
at
org.apache.poi.xslf.usermodel.XMLSlideShow.createSlide(XMLSlideShow.java:243)
at
com.thalesgroup.uk.airscape.investigations.briefinggenerator.PresentationBugger.main(PresentationBugger.java:35)
The following code results in the exception being thrown:
public class PresentationBugger {
public static void main(String... args) throws IOException,
OpenXML4JException, XmlException {
try (XMLSlideShow pptx = new XMLSlideShow(new FileInputStream(new
File("pres.pptx")))) {
pptx.removeSlide(0);
pptx.createSlide();
}
}
}
"pres.pptx" is a presentation (tested with PowerPoint 2010). With one slide in
the presentation, the bug doesn't occur, but with two or more, it does. I've
attached an example of pres.pptx which triggers the bug.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]