Forum


Replies: 1   Views: 2728
On replacement block contents block issues after cloning
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 iiusky  · 31-08-2017 - 10:02

How to clone after block, block content substitution variables inside? I need polyclonal several of the same block, but the contents inside the block variable is different, what should I do to? please help me!

Not know whether there clones that block after phpword automatically increased to variables # 1 # 2 .. This process is similar to?

Posted by admin  · 31-08-2017 - 10:26

Hello,

Which version and license of phpdocx are you using?

About your question, if we understand it fine, you can clone a block using this method:

https://www.phpdocx.com/api-documentation/docx-path/clone-blocks-in-docx

Or clone a single content using this method:

https://www.phpdocx.com/api-documentation/docx-path/clone-elements-in-docx

After you have cloned the block, you can replace the first placeholder using the firstMatch option available in the template methods, then use this same option to replace the next match and so on. Or use DOCXPath with a customQuery.

Regards.