Updating picture placeholder

The powerpoint template I am updating with images uses ‘Picture Placeholders’.

How can I directly update the placeholder pro-grammatically? I can update the associated shape but not the placeholder.

Hi Greg,

Please try the following:

var presentation = PresentationDocument.Load("input.pptx");
var slide = presentation.Slides[0];

var shape = slide.Content.Drawings
    .OfType<Shape>()
    .First(item => item.Placeholder?.PlaceholderType == PlaceholderType.Picture);

shape.Placeholder.SetPicture("input.png");

presentation.Save("output.pptx");

Does this solve your issue?

Regards,
Mario

That was perfect. Thank you.