Cookbook

Add block placeholders

javadocx 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.

To define blocks in a DOCX, create two placeholders with the same name, at the beginning and the end of the region, with the following syntaxis:

$BLOCK_*$

As you can see, blocks keep the same syntaxis as any other javadocx placeholder. You can choose any symbol to enclose it. The dollar symbol ($) is the default one. You are free to write any identifier too, as long as you keep BLOCK_ as the initial string.

For example, you could create this content in a template:

Notice how the $BLOCK_DATA$ placeholders delimit the region.

Warning

Placeholders of the Block kind that define regions must be unique. That is, it could not exist more than one region with the same placeholders identifier.