ASF Bugzilla – Attachment 36087 Details for
Bug 62587
repeated call to XSLFSheet.removeShape leads to java.lang.IllegalArgumentException: partName
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
JUnit causing the problem / workaround
bug62587-junit.java (text/plain), 1.74 KB, created by
Andreas Beeker
on 2018-08-10 22:55:02 UTC
(
hide
)
Description:
JUnit causing the problem / workaround
Filename:
MIME Type:
Creator:
Andreas Beeker
Created:
2018-08-10 22:55:02 UTC
Size:
1.74 KB
patch
obsolete
>@Test >public void bug62587() throws IOException { > ByteArrayOutputStream bos = new ByteArrayOutputStream(); > try (XMLSlideShow ppt = new XMLSlideShow()) { > Slide slide = ppt.createSlide(); > XSLFPictureData pd = ppt.addPicture(slTests.getFile("wrench.emf"), PictureType.EMF); > PictureShape ps = slide.createPicture(pd); > ps.setAnchor(new Rectangle2D.Double(100,100,100,100)); > ppt.write(bos); > } > > Object[][] pics = { > {"santa.wmf", PictureType.WMF, XSLFRelation.IMAGE_WMF}, > {"tomcat.png",PictureType.PNG, XSLFRelation.IMAGE_PNG}, > {"clock.jpg", PictureType.JPEG, XSLFRelation.IMAGE_JPEG} > }; > > try (XMLSlideShow ppt = new XMLSlideShow(new ByteArrayInputStream(bos.toByteArray()))) { > XSLFSlide s1 = ppt.getSlides().get(0); > > for (Object[] p : pics) { > XSLFSlide s2 = ppt.createSlide(); > s2.importContent(s1); > > XSLFPictureData pd = ppt.addPicture(slTests.getFile((String)p[0]), (PictureType)p[1]); > // works > s2.addRelation("myrel", (XSLFRelation)p[2], pd); > XSLFPictureShape ps = (XSLFPictureShape) s2.getShapes().get(0); > CTBlip xo = ((CTPicture) ps.getXmlObject()).getBlipFill().getBlip(); > s2.getPackagePart().removeRelationship(xo.getEmbed()); > xo.setEmbed("myrel"); > > // doesn't work >// XSLFPictureShape ps = (XSLFPictureShape) s2.getShapes().get(0); >// Rectangle2D anchor = ps.getAnchor(); >// s2.removeShape(ps); >// ps = s2.createPicture(pd); >// ps.setAnchor(anchor); > } > > try (FileOutputStream fos = new FileOutputStream("bla.pptx")) { > ppt.write(fos); > } > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 62587
:
36060
| 36087