Free Support Forum -

Header and footer from Template not included after AppendDocument


I am creating a document like this:

Document FinalDocument = new Document();

IList<string> sections = new List<string>();

DocumentBuilder builder = new DocumentBuilder(FinalDocument);

Document frontPage = CreateFrontpage();

builder.Document.AppendDocument(frontPage, ImportFormatMode.KeepSourceFormatting);

// Save the finished document.

string dstFileName = "FinalDocument"+DateTime.Now.ToFileTime()+".docx";

FinalDocument.Save(dataDir + dstFileName);

private static Document CreateFrontpage()


string srcFileName = dataDir + "Frontpage.docx";

IDictionary<string, object> attributes = AttributeHandler.GetAttributes(front);

Document doc = new Document(srcFileName);

DocumentBuilder builder = new DocumentBuilder(doc);

FootnoteOptions footnoteOptions = builder..FootnoteOptions;

// Execute the mail merge.

doc.MailMerge.Execute(attributes.Keys.ToArray(), attributes.Values.ToArray());

return doc;


Frontpage.docx contains a header and a footer, but this is not included in the FinalDocument.

Why do i enable the footer and header on the frontpage of a document?


Thanks for your request. Could you please attach your source documents, output and expected output documents? I will check the issue and provide you more information.

Best regards,