I am using Apache POI 3.12 for interacting with Powerpoint. I open an existing Powerpoint instance:
File file = new File("PATH_TO_FILE...");
XMLSlideShow ppt = new XMLSlideShow(new FileInputStream(file));
In this Powerpoint application, I have defined some named shapes: At runtime I want to replace certain values:
XSLFSlide[] slide = ppt.getSlides();
for (int i = 0; i < slide.length; i++) {
    XSLFShape[] sh = slide[i].getShapes();
    for (int j = 0; j < sh.length; j++) {
        if ("SHAPE_NAME".equals(sh[j].getShapeName())) {
            if (sh[j] instanceof XSLFAutoShape) {
                XSLFAutoShape shape = (XSLFAutoShape) sh[j];
                shape.setText("BlaBla");                
            }
        }
    }
    ...
}
This are working very well, but when I change the text of the Shape, then automatically the defined layout for this Shape it lost. Is there a way to prevent this?
                        
I have solved my issue: You must explicit save the layout settings. Later when you edit the text, you must set these values.