[Bug 65167] New: Not possible to set placeholder picture

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Bug 65167] New: Not possible to set placeholder picture

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=65167

            Bug ID: 65167
           Summary: Not possible to set placeholder picture
           Product: POI
           Version: 5.0.0-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLF
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

In working with POI 5.0.0 (congratulations on the release!), there appears to
be no way to use picture data to fill a layout-defined picture placeholder.

Let's say I'm adding slides using the SlideLayout.PIC_TX layout.  This layout
has three placeholders:  Title, picture, and text.  Calling
slide.getPlaceholders() only returns instances of XLSFAutoShape, which extend
XSLFTextShape, even for the picture placeholder.  I would expect the picture
placeholder shape to provide a method similar to what XSLFPictureShape provides
for using XSLFPictureData to define the picture.

The workaround people appear to be using is to save the anchor of the picture
placeholder, delete the placeholder shape, then call
slide.createPicture(pictureData) and set the returned shape's anchor to the
same as the placeholder's.  See e.g. the answer provided for
https://stackoverflow.com/questions/35721547/how-to-add-image-to-image-placeholder-added-in-pptx-using-apache-poi-api

This will "work" in the sense that the picture will be at the same location and
size the placeholder defined, but deleting the placeholder and replacing it
with a new shape means that the placeholder can't be used to interact with and
change the layout of the picture, either programmatically or as a user editing
the slide working with a slide master.

The shape returned by the getPlaceholder() call should be an abstract class
that the user could instance-check to see if it's a picture shape, a text
shape, or some other shape, and handle it accordingly.

Happy to provide further information as needed, and thanks for bearing with me
as a newbie to the Apache Bugzilla and to POI as well.  Thank you,

-- Joren

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]