Forum


Replies: 5   Views: 501
How to insert a page break after every cloned blocked
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  · 06-09-2023 - 15:29

Hello,

Instead of a text string you need to use a WordFragment. For example:

$htmlFragmentA = new WordFragment($docx);
$htmlFragmentA->embedHtml('<b>John Doe</b>');

$htmlFragmentB = new WordFragment($docx);
$htmlFragmentB->embedHtml('<u>Jane Doe</u>');

$variables = array(
    array(
        'VAR_NAME' => $htmlFragmentA,
        'VAR_DATE' => '11/08/2021',
    ),
    array(
        'VAR_NAME' => $htmlFragmentB,
        'VAR_DATE' => '21/08/2021',
    ),
);

$docx->cloneBlock('FINDINGS', 1, $variables, array('removeBlockPlaceholder' => true));

$docx->deleteTemplateBlock('FINDINGS');

In the examples/Templates/cloneBlock folder of the pakage you can find some other samples using cloneBlock. sample_8.php illustrates using cloneBlock with WordFragments (link and image; HTML and other WordFragments contents work in the same way).

P.S. we have removed your email address from your username

Regards.