This just started happening about a week ago.
Word document missing header code#
I'm not sure if something changed in Word recently because everything did use to work using this code that has been untouched for over a year. I have no idea why the front page image will not show up. If I do a comparison of the document.xml with and without the header image in the Word file, they are identical. Look for the pointer to change to the following: Unhide top and. The image paths and media folder look good as well. Answer: In the open document, move the pointer to the top border of any page in the document. On the Insert tab, in the headers and footers group, click footers to expand its menu. I have verified the document.xml, header.xml, all _rels files, etc after unzipping and everything looks fine to me. Initially, make sure your document pages have content. If skipped, the image appears on front page R.Append(drawing) <- This line causes the issue. Header h = new Header() ĭrawing drawing = BuildImage(imageRelId, "logo_small.jpg", 150, 47) If I leave it in, then the front page image disappears. When building the header, if I comment out the line that appends that drawing, then the front page image remains. I use the same function (BuildImage) to create the Drawing object in both cases.
![word document missing header word document missing header](https://recoverhdd.com/wp-content/themes/soft/images/blog/recover-damaged-microsoft-word-documents/paste-unformatted-text.jpg)
The header image does display as expected. At this point, understand that the main reasons for the numbered headings going out of order are due to the missing links between heading levels that you have. When I add code to include an image in the header as well, the front page image no longer displays-it doesn't even show a placeholder or a red x indicating the image is not found. Part of the code adds an image to the front page of the document, and everything works perfectly. I have code that creates a Word document using the OpenXml SDK.