Forum


Replies: 7   Views: 5263
3.7 => 4.0
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 simon  · 09-06-2014 - 16:19

Hello, I also have the following code which worked perfectly (to create my footer) and it either does not work .... $htmlFooter = htmlspecialchars_decode($htmlFooter); $footer = $docx->embedHTML($htmlFooter, array('rawWordML' => true, 'target' => 'defaultFooter')); $myFooter = $docx->WordFragment(array($footer)); $docx->addFooter(array('default' =>$myFooter)); Now I get the following error Fatal error: Call to undefined method CreateDocx::createWordMLFragment() in /var/www/vhosts/........./httpdocs/creerdocument/pied_de_page.php on line 17 Must find a solution quickly or give me the 3.7 verison for this domain cordially

Posted by jorge  · 10-06-2014 - 06:59

Hello, The new version has a new API and new methods, so you can't use the same code than phpdocx 3.7. Please post this line from your code: --------------------------------------------------- /var/www/vhosts/........./httpdocs/creerdocument/pied_de_page.php on line 17 --------------------------------------------------- Regards.

Posted by simon  · 10-06-2014 - 14:33

Hello, I have version 3.7 on another domain, is what I can copy and paste the folder to another area and put my key? Does it work or am I forced to go with the 4 ?

Posted by admin  · 10-06-2014 - 15:06

Hello, phpdocx 3.7 is deprecated so it's not possible to buy a new license for this version. I recommend you to upgrade to phpdocx 4.0, that includes several new features and as customer you have a discount. The license doesn't allow to use phpdocx on a different subdomain/domain/IP than the purchased. Regards.

Posted by simon  · 11-06-2014 - 09:24

Ok, This is the code on line 17 : $myFooter = $docx->WordFragment(array($footer)); cordially

Posted by admin  · 11-06-2014 - 13:50

Hello, phpdocx 4.0 includes a new WordFragment class, that is not a method but a class. This is a simple example included in the library: //path to the CreateDocx class within your PHPDocX installation require_once '../../../classes/CreateDocx.inc'; $docx = new CreateDocx(); //Create a Word fragment with an image to be inserted in the header of the document $imageOptions = array( 'src' => '../../img/image.png', 'dpi' => 300, ); $footerImage = new WordFragment($docx, 'defaultFooter'); $footerImage->addImage($imageOptions); $docx->addFooter(array('default' => $footerImage)); //add some text $docx->addText('This document has a footer with just one image.'); $docx->createDocx('example_addFooter_1'); You can get more info on: http://www.phpdocx.com/documentation/tutorial Regards.

Posted by simon  · 11-06-2014 - 17:27

Hello, I can not solve my problem with the footer, here below the exact code that worked under 3.7 Can you hear me turn to operate under 4.0 $htmlFooter = $text_entete_pied_ou_contenu; $htmlFooter = htmlspecialchars_decode($htmlFooter); $footer = $docx->embedHTML($htmlFooter, array('rawWordML' => true, 'target' => 'defaultFooter')); $myFooter = $docx->createWordMLFragment(array($footer)); $docx->addFooter(array('default' =>$myFooter)); Indeed, I have found no example that takes html, all the examples are either imports or images ... Thank you in advance

Posted by jorge  · 12-06-2014 - 07:19

Hello, Instead of the 'rawWordML' option, you need to create a new object using the WordFragment class, and them add it to the document. I recommend you to read step by step the new tutorial. Although we'll prepare new .examples. Regards..