Forum


Replies: 2   Views: 242
Remove block placeholders, but not content.
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 kobbe  · 17-05-2019 - 08:29

I have a word template with this setup.

$BLOCK_LOAN$Bla bla bla $DATE$, bla bla bla $CURRENCY$.$BLOCK_ LOAN$

Either I want to remove the whole block, this works well with $docx->deleteTemplateBlock('LOAN');

Or I want to replace the variables DATE and CURRENCY with $docx->replaceVariableByText(['DATE' => 'test', 'CURRENCY' => 'test2']); This also works well and leave me with the result: $BLOCK_LOAN$Bla bla bla test, bla bla bla test2.$BLOCK_ LOAN$ But this leaves me with the placeholders $BLOCK_LOAN$ still in the output. So I tried to remove it with $docx->clearBlocks(); But this removes the whole block. How do I remove the placeholder-text for the block, but not the content?!

I've tried to look at documentation and examples without luck.