https://bz.apache.org/bugzilla/show_bug.cgi?id=65523
Bug ID: 65523 Summary: XSLFSheet.importBlip throws ClassCastException when importing a slide Product: POI Version: 5.0.0-FINAL Hardware: PC OS: All Status: NEW Severity: major Priority: P2 Component: XSLF Assignee: dev@poi.apache.org Reporter: sabine.h...@berenberg.de Target Milestone: --- Created attachment 37995 --> https://bz.apache.org/bugzilla/attachment.cgi?id=37995&action=edit PowerPoint with slide, which has a uncopiable picture Any slide import for pictures fails, if the user edited the picture color using Powerpoint. In our case the slide contained a colored picture, which was edited to show as grey (Picture Color -> Color Saturation -> 0%) An sample presentation and code will be uploaded with this ticket. ---------------------------------------------------------------------------- Test code: import org.apache.poi.xslf.usermodel.XMLSlideShow; import org.apache.poi.xslf.usermodel.XSLFSlide; import org.springframework.core.io.ClassPathResource; import java.io.ByteArrayOutputStream; class Scratch { public static void main(String[] args) throws Exception { XMLSlideShow targetPresentation = new XMLSlideShow(); XSLFSlide targetPresentationSlide = targetPresentation.createSlide(); XMLSlideShow sourcePresentation = new XMLSlideShow(new ClassPathResource("POI_Blip_bug.pptx").getInputStream()); XSLFSlide sourceSlide = sourcePresentation.getSlides().get(0); targetPresentationSlide.getSlideMaster().importContent(sourceSlide.getSlideMaster()); targetPresentationSlide.getSlideLayout().importContent(sourceSlide.getSlideLayout()); targetPresentationSlide.importContent(sourceSlide); targetPresentation.write(new ByteArrayOutputStream()); } } -------------------------------------------------------------------------------- Exception in thread "main" java.lang.ClassCastException: class org.apache.poi.ooxml.POIXMLDocumentPart cannot be cast to class org.apache.poi.xslf.usermodel.XSLFPictureData (org.apache.poi.ooxml.POIXMLDocumentPart and org.apache.poi.xslf.usermodel.XSLFPictureData are in unnamed module of loader 'app') at org.apache.poi.xslf.usermodel.XSLFSheet.importBlip(XSLFSheet.java:651) at org.apache.poi.xslf.usermodel.XSLFPictureShape.copy(XSLFPictureShape.java:385) at org.apache.poi.xslf.usermodel.XSLFSheet.wipeAndReinitialize(XSLFSheet.java:455) at org.apache.poi.xslf.usermodel.XSLFSheet.importContent(XSLFSheet.java:434) at org.apache.poi.xslf.usermodel.XSLFSlide.importContent(XSLFSlide.java:293) -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org