poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 59434] New: Cannot add a picture on a slide that already have an image with an hyperlink on it
Date Fri, 06 May 2016 16:19:51 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=59434

            Bug ID: 59434
           Summary: Cannot add a picture on a slide that already have an
                    image with an hyperlink on it
           Product: POI
           Version: 3.14-FINAL
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLF
          Assignee: dev@poi.apache.org
          Reporter: amanteaux+bzapache@gmail.com

If a slide has a picture, it is possible to add a new picture on the slide
using the code :
byte[] pictureData = IOUtils.toByteArray(new FileInputStream("image.png"));
XSLFPictureData pd = ppt.addPicture(pictureData, PictureData.PictureType.PNG);
XSLFPictureShape pic = slide.createPicture(pd);

However, if the picture already present on the slide have an hyperlink on it,
the new picture cannot be added to the slide.
Here is the stack trace generated:
Exception in thread "main" org.apache.poi.POIXMLException: invalid package
relationships
    at
org.apache.poi.POIXMLDocumentPart.findExistingRelation(POIXMLDocumentPart.java:368)
    at
org.apache.poi.POIXMLDocumentPart.addRelation(POIXMLDocumentPart.java:330)
    at
org.apache.poi.xslf.usermodel.XSLFSheet.createPicture(XSLFSheet.java:226)
    at PoiTest.main(PoiTest.java:25)
Caused by: org.apache.poi.openxml4j.exceptions.InvalidFormatException: Absolute
URI forbidden: http://google.fr/test_poi
    at
org.apache.poi.openxml4j.opc.PackagePartName.throwExceptionIfAbsoluteUri(PackagePartName.java:428)
    at
org.apache.poi.openxml4j.opc.PackagePartName.throwExceptionIfInvalidPartUri(PackagePartName.java:177)
    at
org.apache.poi.openxml4j.opc.PackagePartName.<init>(PackagePartName.java:85)
    at
org.apache.poi.openxml4j.opc.PackagingURIHelper.createPartName(PackagingURIHelper.java:493)
    at
org.apache.poi.openxml4j.opc.PackagePart.getRelatedPart(PackagePart.java:485)
    at
org.apache.poi.POIXMLDocumentPart.findExistingRelation(POIXMLDocumentPart.java:362)
    ... 3 more

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message