Replace Text in Placeholder using Aspose.Slides

Aspose.Slides - Replace Text in Placeholder

Using Aspose.Slides for Java , developers can also find and modify a specific Placeholder present in a slide. In this topic, we are going to demonstrate with the help of an example that how the text contained inside a Placeholder can be replaced or modified using Aspose.Slides for Java.


 //Instantiate Presentation class that represents PPTX

Presentation pres = new Presentation(dataDir + "demo.pptx");

//Access first slide

ISlide slide = pres.getSlides().get_Item(0);

IShape shape= null;

//Iterate through the shapes and set a reference to the table found

for (int i = 0 ; i < slide.getShapes().size() ; i++)


    shape = slide.getShapes().get_Item(i);

    if (shape.getPlaceholder() != null)


        //Change the text of each placeholder

        ((IAutoShape)shape).getTextFrame().setText("This is Placeholder");



//Write the PPTX to Disk + "AsposeReplaceTxt.pptx",SaveFormat.Pptx);

Download Running Code

Download Sample Code