Bug 62928

Summary: XSLFSlide.appendContent changes the PictureData of an existing picture
Product: POI Reporter: francesco.gatta
Component: XSLFAssignee: POI Developers List <dev>
Status: NEW ---    
Severity: normal CC: francesco.gatta
Priority: P2    
Version: 4.0.0-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description francesco.gatta 2018-11-20 08:57:26 UTC
I have one slide originalSlide which is empty.

I have a second slide contentSlide which contains a few shapes including one picture.

I create a new picture into originalSlide like this:

                Integer imgIdx = null;
		for (XSLFPictureData p : output.getPictureData()) {
			if (Arrays.equals(p.getData(), img.getData())) {
				//img exists, no need to add
				imgIdx = p.getIndex();
				break;
			}
		}
		
		if (imgIdx == null) {
			imgIdx = output.addPicture(img.getData(), img.getType()).getIndex(); //output is the XMLSlideShow
		}
                XSLFPictureShape s2 = originalSlide.createPicture(output.getPictureData().get(imgIdx));

I create a third slide cloneSlide and import all content from the original slide.

                XSLFSlide cloneSlide = output.createSlide().importContent(originalSlide);

Then, I try to append all content from contentSlide, and the content of my picture s2 gets replaced with the image from contentSlide, but in originalSlide the content of s2 is correct:


cloneSlide.appendContent(contentSlide);