Clean existing blocks
The deleteTemplateBlock method deletes block placeholders along with the whole of the region they enclose. This functionality allows to define optional regions in a DOCX template and decide whether or not to delete them dynamically.
E.g., the code that follows replaces an existing placeholder in a document, then erases the whole region delimited by $BLOCK_CHARTS$ placeholders and finally cleans the rest of the block placeholders:
Note that to call the deleteTemplateBlock method you have to write the placeholder identifier without neither the $BLOCK_ prefix (or any other custom block prefix using setTemplateBlockSymbol) nor the final $ symbol.