Forum


Replies: 4   Views: 3912
Links in header and footer
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 Choura  · 15-10-2014 - 09:25

Hello, I'm trying to add a link to the body, the header and ther footer with this code : include('phpdocx/classes/CreateDocx.inc'); $link = '< a href = " http://www.google.fr " > http://www.google.fr < / a >'; $docx = new CreateDocx(); $docx->embedHTML($link, array("downloadImages" => true)); $header = new WordFragment($docx, 'defaultHeader'); $header->embedHTML($link, array("downloadImages" => true)); $docx->addHeader(array('default' => $header)); $footer = new WordFragment($docx, 'defaultFooter'); $footer->embedHTML($link, array("downloadImages" => true)); $docx->addFooter(array('default' => $footer)); $docx->createDocx('test'); I obtain a word document wich has an error in the header and the footer. However it opens in "compatibility mode" and only the link in the body works. "Links" in header and footer are just blue underlined texts. I checked the word hyperlink tag inside the code and all 3 are exactly the same. I use the 4.0 version of phpdocx. Can anybody help me plz ?

Posted by admin  · 17-10-2014 - 09:09

Hello, What license of phpdocx are you using? Regards.

Posted by Choura  · 17-10-2014 - 10:06

Hello, I have a Corporate license.

Posted by admin  · 17-10-2014 - 11:15

Hello, Please open CreateDocx.inc and remove this line (6163): $this->_relsHeaderFooterLink[$options['target']][] = array('rId' => $key, 'url' => $value); and add this one: CreateDocx::$_relsHeaderFooterLink[$options['target']][] = array('rId' => $key, 'url' => $value); and try again. We're doing some tests to upload a new package with this fix included. Regards.

Posted by Choura  · 17-10-2014 - 12:54

It works. Thank you.