Hello,
The serial/page content to be imported or kept must have something to be queried by (position, content, format, ID or any other property as DOCXPath requires). If you want to automatize it you need to be able to query it correctly to don't get other unwanted contents.
The importHeadersAndFooters method import contents (and inline styles) not external styles. If the contents to be imported include external styles that are not avaiable in the template then you need to create them to get the same output, otherwise the default styles from the template will be used.
Regards.