Hello,
addHeader and addFooter methods remove existing headers and footers. These methods are available to be used when creating a DOCX from scratch, not with templates, because existing headers/footers are removed, and the new headers/footers are added only to the last section.
To add contents to headers/footers to a DOCX template you can use the following methods:
- addHeaderSection and addFooterSection methods that include the removeOthers option to keep or remove existing headers and footers.
- importHeadersAndFooters: the recommended way. You need to create a DOCX with the headers/footers to be imported and import them (default and first must be applied to addHeader)
- add placeholders in headers and footers in the template and then use template methods to replace the placeholders by the new contents
Regards.