Forum


Replies: 3   Views: 3989
Replacevariablebytext not working in a header section
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 afoeder  · 27-01-2015 - 15:11

Hi, replacing a variableByTest does not work in some cases, the getFromZip method returns FALSE because, it seems, something's wrong with the word/header1.xml occurrence of the XPath. There is, for example, $xpathFooters = simplexml_import_dom($this->_contentTypeT); $xpathFooters->registerXPathNamespace('ns', 'http://schemas.openxmlformats.org/package/2006/content-types'); $xpathFootersResults = $xpathFooters->xpath('ns:Override[@ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml"]'); foreach ($xpathFootersResults as $footersResults) { $footer = substr($footersResults['PartName'], 1); $loadContent = $this->getFromZip($footer); … This $loadContent becomes FALSE and the subsequent code crashes because of that. $footer is "word/footer1.xml", $this->getFromZip returns FALSE because $XMLData = $zip->getFromName($src); already returns FALSE. Any ideas how to resolve this?