Forum


Replies: 2   Views: 3183
How can i copy section and paste it n-times to document?
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@intuswindows.com  · 13-10-2016 - 14:28

Hi, i have a document from template file and wont itterate some section n-times, before paste some data.

How can i do that?

Thx.

 

Posted by admin@intuswindows.com  · 14-10-2016 - 04:25

Wow, sorry, missed version update...

I think i can use this method.

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

Posted by admin  · 14-10-2016 - 06:56

Hello,

The method cloneWordContent (http://www.phpdocx.com/api-documentation/docx-path/clone-elements-in-docx) can clone elements but not whole sections in a step. Using this method you can clone a whole section selecting and cloning each individual element.

The easiest approach is to use the mergeDocx method (http://www.phpdocx.com/documentation/cookbook/merge-docx-documents). Instead of cloning the section, we recommend you to create a DOCX with the content of the section and merge it as many times as needed.

You can see a similar approach on this cookbook page:

http://www.phpdocx.com/documentation/cookbook/merge-docx-documents

Regards.