Forum


Replies: 3   Views: 3471
Importheadersandfooters doesnt work properly
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by Graff  · 26-08-2012 - 14:01

Hi.

importHeadersAndFooters doesnt work after addTemplate. Here is code example from phpdocx (TemplateDOCX.php):

[code]require_once '../../classes/CreateDocx.inc';

$docx = new CreateDocx();

$docx->addTemplate('../files/TemplateText.docx');

$docx->addTemplateVariable('WEIGHT1', '10');
$docx->addTemplateVariable('WEIGHT2', '20');
$docx->addTemplateVariable('WEIGHT3', '25');

$docx->addTemplateVariable('PRICE1', '5');
$docx->addTemplateVariable('PRICE2', '30');
$docx->addTemplateVariable('PRICE3', '7');

$docx->addTemplateVariable('TOTALWEIGHT', '55');

$docx->addTemplateVariable('TOTALPRICE', '42');

$docx->addTemplateVariable('NAME', '../files/Text.docx', 'docx');
$docx->importHeadersAndFooters('../files/TemplateHeaderAndFooter.docx','header'); // I added this line from importHeaderAndFooter.php
$docx->createDocx('../docx/template_docx_text');[/code]

The problem is that this code compleatly ingnores [code]$docx->importHeadersAndFooters('../files/TemplateHeaderAndFooter.docx','header');[/code] I get docx with default header. I tryed many variants and result is the same.

How can I get work importHeadersAndFooters in this case?