i am currently working on a C# tool that replaces placerholder images in word-documents. I using Word.Shapes to find the correct placeholder. Everything is working fine except that the replaced image is placed on a totally wrong position in the word-document.
New image after replace on totally different position:

Here the code for the image replacement:
float left = targetImage.Left;
float top = targetImage.Top;
float width = targetImage.Width;
float height = targetImage.Height;
Word.Shape newImage = doc.Shapes.AddPicture(Program.Path_TempQRCode,
Left: left, Top: top,
Width: width, Height: height);
targetImage.Delete();
I am pretty sure that the issue is somehow depended to the anchor. I already tried the following:
Word.Range range = targetImage.Anchor;
float left = targetImage.Left; // Store the original left position of the image
float top = targetImage.Top; // Store the original top position of the image
range.Select();
Word.Shape newImage = doc.Shapes.AddPicture(Program.Path_TempQRCode);
newImage.Width = targetImage.Width; // Set the width of the new image to match the original image
newImage.Height = targetImage.Height; // Set the height of the new image to match the original image
newImage.Left = left; // Set the left position of the new image to match the original image
newImage.Top = top; // Set the top position of the new image to match the original image
newImage.AlternativeText = "";
// Release the selection
targetImage.Delete(); // Delete the original image
doc.Application.Selection.ClearFormatting();
But the approach with Word.Range doesn't work, too.
Has anyone else an solution for this problem?

I found the reason for the issue: Example
The reason is the little blue anchor to the left in the document. When I drag&drop the anchor to the absolut top in the document the image will replaced correctly. If the anchor stays on a lower position the placement is wrong. I am pretty sure that the coordinates i read from targetImage.Anchor are wrong related to this issue.
My current workaround is to fix the anchor position manually in the document. Now I need to find a c# solution to identify and reposition this anchor in the runtime.