Categories > OpenTBS with DOCX >

Send param to header docx

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: qiu
Date: 2010-11-13
Time: 14:18

Send param to header docx

Can opentbs receive parameter in the header/footer file of docx? Im try using onshow & sending with array but nothing happen.
By: Skrol29
Date: 2010-11-14
Time: 00:38

Re: Send param to header docx

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










By: qiu
Date: 2010-11-14
Time: 04:20

Re: Send param to header docx

Thank you Skrol29- just what I needed..thanks for your help