Free Support Forum - aspose.com

Overlay Word Document over another Word Document

Hi,

We have a requirement to overlay one MS Word document over another… think we have one document containing content and another word document containing the footer / header details which we’d like to overlay the other word document prior to conversion to PDF.

Is this possible?

Thanks

@jayoffice365,

You can copy all Headers and Footers from first Section to the document containing content by using the following code:

Document doc = new Document("D:\\temp\\originaldocument.docx");
Document hfDoc = new Document("D:\\temp\\HeaderFooterDocument.docx");

foreach (HeaderFooter hf in hfDoc.FirstSection.HeadersFooters)
{
    doc.FirstSection.HeadersFooters.Add(hf.Clone(true));
}

doc.Save("D:\\temp\\Documents\\18.7.docx");