Placeholder — Aspose.Slides FOSS for Java API Reference

In Aspose.Slides FOSS for Java, placeholders are accessed through the IPlaceholder interface returned by GeometryShape.getPlaceholder(). A placeholder identifies a shape’s role on a layout or master slide (e.g., title, body, footer).

Package: org.aspose.slides.foss

import org.aspose.slides.foss.*;

Accessing Placeholders

Placeholders are exposed as a property on shapes (via IGeometryShape):

IPlaceholder placeholder = shape.getPlaceholder();

If the shape is not a placeholder, getPlaceholder() returns null.


IPlaceholder Interface

PropertyTypeDescription
getType()PlaceholderTypePlaceholder type (TITLE, BODY, FOOTER, etc.).
getIndex()intPlaceholder index.
getSize()PlaceholderSizePlaceholder size category.

Usage Examples

Find Placeholder Shapes

import org.aspose.slides.foss.*;

Presentation prs = new Presentation("deck.pptx");
ISlide slide = prs.getSlides().get(0);

for (int i = 0; i < slide.getShapes().size(); i++) {
    IShape shape = slide.getShapes().get(i);
    if (shape instanceof IGeometryShape) {
        IPlaceholder ph = ((IGeometryShape) shape).getPlaceholder();
        if (ph != null) {
            System.out.println("Placeholder type: " + ph.getType()
                + " at index " + ph.getIndex());
        }
    }
}

See Also