Insert image file to publisher document in place of existing image

486 Views Asked by At

I have publisher document used as template.

enter image description here

How to insert image from file in place of "?" image.

Probably it's same way as for MS Word but I can't find out.

I access that template this way:

using Publisher = Microsoft.Office.Interop.Publisher;

Publisher._Application pubApp = new Publisher.Application();
Publisher.Document doc = pubApp.Open(docPath);
Publisher.Page templateCard = doc.Pages[1];
1

There are 1 best solutions below

1
InfernumDeus On BEST ANSWER

Basically:

shape.PictureFormat.Replace(filePath);

Best way to find my template image I figured out is set alternative text to my image and just chack it:

foreach (Publisher.Shape shape in currenPage.Shapes) {
    if (shape.AlternativeText == "DICKBUTT")
        //here you do your stuff
}