Forum


Replies: 5   Views: 1354
Clone block and replace content
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 AurelienC  · 27-08-2018 - 09:48

Thansk for your reply, it works with the "firstmatch" method.

However, I still have trouble on how to order the blocks.
Let's say I have this template :

$BLOCK_uppercase$

I AM UPPERCASE

$BLOCK_uppercase$

$BLOCK_lowercase$

i am lowercase

$BLOCK_lowercase$

With this code :

$docx->cloneBlock('uppercase',1);
$docx->cloneBlock('lowercase',2);
$docx->cloneBlock('uppercase',3);
$docx->cloneBlock('uppercase',4);
$docx->cloneBlock('lowercase',5);
$docx->cloneBlock('lowercase',6);

I end up with : 

I AM UPPERCASE
I AM UPPERCASE
I AM UPPERCASE
i am lowercase
i am lowercase
i am lowercase

Instead of :

I AM UPPERCASE
i am lowercase
I AM UPPERCASE
I AM UPPERCASE
i am lowercase
i am lowercase

I might be using the "occurrence" parameter in the wrong way, I don't know.

PS : Version 7 and an advanced licence.