While Processing Template in PHPWord It's not opening after saving the template

493 Views Asked by At

I looked for various answers over stackoverflow they all are not working in my case. my problem is that i am processing a template in PHPWord it is being saved and problem arised now are: 1. document is not opening giving error like this image

  1. few blocks are not being deleted or replaced i.e : $templateProcessor->deleteBlock('deleteme'); and $templateProcessor->replaceBlock('replaceme','Hello Dear'); neither giving error nor looking to be executed at last it saves my document. and the document is not being opened.

  2. if i comments $templateProcessor->deleteBlock('deleteme'); and $templateProcessor->replaceBlock('replaceme','Hello Dear'); in my code then everything is fine other things are being executed and also doc is being opened by MS Office Word.

1

There are 1 best solutions below

0
On BEST ANSWER

The Problem Persist There Was The Complex Value That I was Using In That Block. I have used replaceBlock() & setComplexValue() over $templateProcessor and its working fine now.