Forum


Replies: 2   Views: 2142
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 admin  · 17-05-2019 - 08:42

Hello,

clearBlocks remove placeholders doing a block replacement, so if the paragraph of the block placeholder has other contents they are removed as well.

You can use the removeTemplateVariable method to remove any placeholder by its name. Please note that the default behaviour of this method is removing the block content (this is the full paragraph), but you can set the type option as inline to do an inline remove. Please check and run the included sample in the package that illustrates both uses.

Regards.