Clean blocks placeholders
phpdocx includes several methods to work with block elements. These elements allow to define regions made of one or more contents in a DOCX, which can be cleaned of placeholders, deleted and cloned.
You can replace any placeholder in a region defined by placeholders. To do it just run the template methods of phpdocx or DOCXPath, just like you would do with any other placeholder or content in the document.
The advantage of blocks is that after working with a document you can call the clearBlocks method to delete all placeholders of the block kind. The content of these placeholders would be unaltered.
For example, the following code substitutes an existing placeholder in a document inside of a region delimited by blocks. Then the code deletes from template.docx all block placeholders.