This project has moved. For the latest updates, please go here.

InsertDocument does not include headers and footers

Jan 18, 2013 at 8:36 AM


Is it possible that the InsertDocument function could include the headers and footer from the document that is being inserted.


Jan 21, 2013 at 5:48 AM


I was able to get the desired results. Thanks for the great library.


Mar 28, 2014 at 8:11 PM

How do you do that? I need to do exactly the same.

Apr 3, 2014 at 4:19 AM
Hi WernerS83,

Could you explain how you did that? I really need this to work, but most of the docx tools I found seems not to support it (or perhaps I haven't figured out?).
Thanks a lot!

Apr 3, 2014 at 8:21 AM
Hi Catherine, Cesar1484,

There is one way to accomplish something similar, though I'm not sure if this would work for you. It's possible when your 'base document' contains headers and footers.
So if you wish to merge document A, B and C and document B contains headers/footers, they will be included when you use B.InsertDocument(A) and B.InsertDocument(C).

I haven't found a way to include the headers from document A or C in the above example. WernerS83 might have figured out how to include the headers and footers from the document that is being iserted though.
Apr 4, 2014 at 2:13 AM
Thanks a lot, Annika! I'll try it. :D