Free Support Forum - aspose.com

How to replace the default picture text for picture frame

Hi Team,

I try to replace the default “Picture” which comes when we drag any picture placeholder. I try to find out the way to read and replace that word using the ASPOSE slide but not get any solution. Can you please suggest the way to do this?
Here is the image for your reference - image-20200302-215203.png (207.4 KB)

@Shree995,

I have observed the snapshot shared and have not been able to completely understand your requirements. Can you please share the source presentation, generates presentation and desired out put presentation with us.

@Shree995

It seems that you are interested in setting default placholder text that is appearing as default text for placeholder. It is called Prompt text and using Aspose.Slides API, you can alter it.

This text (“Please click…”) generated by PowerPoint for these placeholders, it does not exist in a document itself and we didn’t have it in Slides. You may add it manually too, as an option:

using (Presentation pres = new Presentation("pres.pptx"))
{
    ISlide slide = pres.Slides[0];
    foreach (IShape shape in slide.Slide.Shapes) // iterate through the slide
    {
        if (shape.Placeholder != null && shape is AutoShape)
        {
            string text = "";
            if (shape.Placeholder.Type == PlaceholderType.CenteredTitle) // title - the text is empty, PowerPoint displays "Click to add title". 
            {
                text = "Click to add title";
            }
            else if (shape.Placeholder.Type == PlaceholderType.Subtitle) // the same for subtitle.
            {
                text = "Click to add subtitle";
            }

            Console.WriteLine($"Placeholder with text: {text}");
        }
    }
}