Importing Headers and Footers into a DOCX
Return to the
Developer CenterSometimes you may want to set the headers and footers for all documents in a folder so that they all have standard information in headers/footers. The problem is that moving headers and footers from one document into another is not as simple as copying the header and footer parts over. Those headers and footers can have markup and relationships that refer to images, DrawingML parts, charts or more. Further, they may be styled with specific styles, or have numbering that requires information from the numbering part.
We can use DocumentBuilder to create a document that contains the body of one document and the header/footer of another document. Along the way, DocumentBuilder will resolve all of the interrelated markup, moving all of the appropriate pieces into the destination document. Here is a small video that shows how to do this: