dotnet / dotnet/Open-XML-SDK

Adding image to document with image in header: Existing image no longer visible

Open
#1,040 12 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.6k
Forks
605
PR merge metrics
No merged PRs in 30d

Description

When adding an image to a docx that has a header with an image in it, the image in the header is no longer displayed in word after the new image has been added.

- NET Framewor 4.8
- DocumentFormar.OpenXml 2.13.1.0

This repros using the example code from msdn here ( https://docs.microsoft.com/en-us/office/open-xml/how-to-insert-a-picture-into-a-word-processing-document?redirectedfrom=MSDN), when using a docx that conatins a header which includes an image. Example docx attached to this issue. vs 2019 project with full sample code also attached to this issue.

**Observed**

- Image from header is no longer displayed in word after image has been added to body.

**Expected**

- both images should be displayed in word

(i have a so quation concerning this problem, including full description of things i tried hier: https://stackoverflow.com/questions/69637082/inserting-image-into-docx-using-openxml-removes-image-from-header )

[docx-problem-files.zip](https://github.com/OfficeDev/Open-XML-SDK/files/7379481/docx-problem-files.zip)
[docx-problem-source.zip](https://github.com/OfficeDev/Open-XML-SDK/files/7379482/docx-problem-source.zip)
.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.