Hi Qiu,
Yes it can.
Headers and footers of a DOCX file are saved under optional subfiles in the DOCX archive.
Those files are usually:
"word\header1.xml" ,
"word\header2.xml" ,
"word\header3.xml" , ...
and
"word\footer1.xml" ,
"word\footer2.xml" ,
"word\footer3.xml" ...
You may have 3 header subfiles (or footer subfiles) even if you defined only one header in the main document. This is because Ms Word creates 3 headers by default: First, Default and Even.
If you've defined only one header, it's usually corresponding to "word\header2.xml" which means the default header. (it is the same for footers)
So if you want to merge data in the header or footer, you have to load the subfile first.
It's better to do this when you're done with merging the main contents.
Here is an example:
$TBS->LoadTemplate('example.docx');
... // merge main contents here
$TBS->LoadTemplate('#word\header2.xml');
... // merge header contents here
$TBS->LoadTemplate('#word\footer2.xml');
... // merge footer contents here
|