Slide Background Elements Presented as Regular Elements in Aspose.Slides for Java

Hello,

We’ve stumbled on an issue when processing the background of slides with Aspose.Slides for Java.

PowerPoint has the feature “Designer” in the “Design” tab (see powerpoint-designer.jpg (124.4 KB)) which allows to auto-generate different backgrounds for slides. Such backgrounds are then populated with various elements, but those elements aren’t accessible to the user in the slides and the user can’t interact with them directly. (Don’t know whether there are other ways to add such elements to PowerPoint presentations.)

The issue that we are dealing with is that those background elements are presented in the Aspose.Slides API as if they were regular slide elements inserted by the user, when in fact they are part of the background.

For example, when we open the attached presentation in PowerPoint, the first slide doesn’t contain any elements that the user can interact with, yet Aspose.Slides (e.g. version 24.10) returns that there are 8 elements:

Presentation pres = new Presentation("presentation-with-designer-theme.pptx");
ISlide slide = pres.getSlides().get_Item(0);
System.out.println(slide.getShapes().size());
pres.dispose();

I wanted to ask whether there’s a way to recognize when a specific slide element is part of the background and wasn’t added by the user?

Thanks

presentation-with-designer-theme.pptx.zip (50.4 KB)

@dfinsolutions,
Thank you for posting the question. I need some time to check the issue. I will get back to you soon.

@dfinsolutions,
Thank you for your patience. The background shapes added to the slides and not available for user interaction are regular presentation shapes with some properties locked. Please use the following code example to view them.

Presentation presentation = new Presentation("presentation-with-designer-theme.pptx");
ISlide slide = presentation.getSlides().get_Item(0);

for (IShape shape : slide.getShapes()) {
    if (shape instanceof IAutoShape autoShape) {
        IAutoShapeLock lock = autoShape.getAutoShapeLock();

        System.out.println("Shape name: " + autoShape.getName());
        System.out.println("Arrowheads locked: " + lock.getArrowheadsLocked());
        System.out.println("Adjust handles locked: " + lock.getAdjustHandlesLocked());
        System.out.println("Grouping locked: " + lock.getGroupingLocked());
        System.out.println("Position locked: " + lock.getPositionLocked());
        System.out.println("Rotate locked: " + lock.getRotateLocked());
        System.out.println("Aspect ratio locked: " + lock.getAspectRatioLocked());
        System.out.println("Edit points locked: " + lock.getEditPointsLocked());
        System.out.println("Select locked: " + lock.getSelectLocked());
        System.out.println("Shape type locked: " + lock.getShapeTypeLocked());
        System.out.println("Size locked: " + lock.getSizeLocked());
        System.out.println("Text locked: " + lock.getTextLocked());
        System.out.println();
    }
}

presentation.dispose();

I hope this will help you.

Thanks for the response.

We’ll be trying to identify such background shapes with lock properties.

Thank you

@dfinsolutions,
Thank you for using Aspose.Slides for Java.