Using shape placeholders

Hi
I have looked at several similar questions and examples, but none of them seems to give me the results I am after.
I create an empty presentation using:
pres = new Aspose.Slides.Presentation();
This create an empty presentation with a MasterLayoutSlideCollection with 11 layouts:

  • Title
  • TitleAndObject
  • SectionHeader
  • TwoObjects
  • VerticalTitleAndText

I can iterate through these, and e.g. if I want to use the “TwoObjects” one in an new slide, I can do it this way:

        //I want to find the "TwoObject" type
        slc.LayoutType = SlideLayoutType.TwoObjects;
        IMasterLayoutSlideCollection layoutSlides = pres.Masters[0].LayoutSlides;
        //Iterate through and see if already in master
        foreach (ILayoutSlide curLayoutSlide in layoutSlides)
        {
            if (curLayoutSlide.LayoutType == slc.LayoutType)
            {
                slc.LayoutSlide = curLayoutSlide;
                break;
            }
        }
        //Insert the layout, in case it does not exists
        if (slc.LayoutSlide == null)
        {
            slc.LayoutSlide = layoutSlides.Add(slc.LayoutType, SlideLayout);
        }
        //Add a slide with this layout
        sld = pres.Slides.InsertEmptySlide(0, slc.LayoutSlide);

Now comes my issue. This slide has 3 placeholders, one for the text on top, and two for the objects. I now want to fill the two “object” placeholders with a chart, but I do not understand how to do this. The only thing I manage is to create new shapes, where I copy the dimensions and placement of the placeholders, but then the placeholders are then still present (I can of course delete them), but if the PowerPoint user later wants to apply a different template, the charts will not be resized etc, since PowerPoint will not recognize that these are part of a “standard” layout any more.

So an example of how to fill these two “Object” placeholders with 2 charts would be very welcome.

Regards Bjorn

Hi Bjorn,

Thank you for your interest in Aspose.Slides.

I have observed your comments and like to share with you that you can use the Alternative Text property of the place holder as explained in this documentation article and then check the size of that placeholder then filling it with a chart will satisfy your requirements.

I hope this will be helpful. Please share if I may help you further in this regard.

Best Regards,