Hi,
I would love some help on this. I’m trying to take the contents of one document and insert it as the header of another. I’m just doing a quick hack to see if it can be done:
public static void AddHeadderFooter(Document header, Document dest, HeaderFooterType type)
{
dest.Sections[0].ClearHeadersFooters();
HeaderFooter hf = new HeaderFooter(dest, type);
Node n = dest.ImportNode(header.Sections[0], true, ImportFormatMode.KeepSourceFormatting);
hf.AppendChild(n);
dest.Sections[0].HeadersFooters.Add(hf);
}
but I am not allowed to append a Section Node into the HeaderFooter object.
What is the best way to do this? I would like to keep formatting and images etc from another document if possible?
Thanks for your quick response. I’ve tried what you have posted, things seem to run fine, but my resulting document has an empty header/footer. I can’t figure out why?