Forum


Replies: 3   Views: 3358
Deletetemplateblock is longer working after merging templates
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 Bouillou  · 11-05-2015 - 11:42

Thanks for your answer. After merging, the resulting template is correct, but deleteTemplateBlock is not working. In case I try to re-use the previous merging template and disable my merging condition, it is working : so the merged file is correct. In summary, the deleteTemplateBlock function is not working only if I am using a template just merged. Here is my code (PHPDocX version 4.5.1 BTW) : if($this->getService()->getDisplayNotificationStatus()) { $template = $outputPath.$folder.uniqid().'-'.$user->getId().'.docx'; $merge = new \Phpdocx\BatchProcessing\MultiMerge(); $merge->mergeDocx($templatePath.$templateName, array($templatePath.$notificationTemplateName), $template, array()); } else { $template = $templatePath.$templateName; } // Load template $docx = new \Phpdocx\Create\CreateDocxFromTemplate($template); // Manage charges texts blocks if($deleteBlockA) { $docx->deleteTemplateBlock('a_charge'); } if($deleteBlockB) { $docx->deleteTemplateBlock('b_charge'); } if(deleteBlockC) { $docx->deleteTemplateBlock('c_charge'); }