Forum


Replies: 5   Views: 440
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 fiwoyax200  · 06-09-2023 - 11:26

Hi,

How could I modify my PHP code to add a page break after every cloned block to ensure every block is on a new page. My PHP code is as follows:

 

$variables = array(
    array(
        '1' => 'Test 1',
        '2' => 'John Doe',
        '3' => '2',
        '4' => '11/08/2021',

    ),
    array(
        '1' => 'Test 2',
        '2' => 'John Doe',
        '3' => '2',
        '4' => '11/08/2021',
    ),
);

// clone block setting the variables to be replaced
$docx->cloneBlock('FINDINGS', 1, $variables, array('removeBlockPlaceholder' => true));

// delete remaining block
$docx->deleteTemplateBlock('FINDINGS');