Created attachment 31873 [details] Powerpoint file with three pictures. First picture is embedded, second picture is linked and embedded, third picture is only linked. When adding a picture to a PowerPoint presentation, you can embed the file or link to it. The embedded filename can be accessed using: XSLFPictureData data = ((XSLFPictureShape) shape).getPictureData(); System.out.println(data.getFileName()); output: org.apache.poi.xslf.usermodel.XSLFPictureShape@654df764 image7.png However, when the picture is not embedded but inserted only as a "link to file", there is no data available and the above code produces a null pointer exception. Is it possible to add a reference to the linked picture file ?
Created attachment 31874 [details] Code to demonstrate null pointer error when picture is only linked (third picture in attached Powerpoint file). The third picture in the referenced Powerpoint file is a linked picture (not embedded). data.getFilename() returns a null pointer exception but it would be useful if it returned the name of the linked picture file.
Thanks for this, I've used it to add a disabled unit test in r1615803.
Fixed in r1615812. XSLFPictureShape now provides a method isExternalLinkedPicture(), which lets you check if it'll have a picture data or not. If not, you can use getPictureLink() to get the URI of the externally linked image. (You can't get a XSLFPictureData as the data isn't in the pptx file)