Investment funds

  • image
  • image
  • image

A document, filled with a list of blocks that are populated with charts, images and texts. Then the blocks are cleaned, so just the data is shown.

Create a document with a list of replaceable blocks with phpdocx

A bank wants to display a list of some investment funds. To do this, they make use of the functionality of the phpdocx blocks.

First, they create a template with two blocks delimited by $BLOCK_ *$, in which * is replaced by the name of the specific block. In this case, the template has a block with a chart and a text, and another block with text and an image.

From this template, the blocks can be deleted with deleteTemplateBlock, or cloned with cloneBlock. Within the blocks there are placeholders that can be substituted to introduce differences in the cloned blocks. Finally, the delimiting marks of the blocks are cleaned with clearBlocks.