Forum


Replies: 7   Views: 3400
How to add multiple block in a docx
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 mahendra.s  · 01-06-2015 - 07:08

Hello, i was try to add multiple block in a docx we have : block 1 :- Job title Date From To Date to Job Name block 2:- Job title Date From To Date to Job Name block 3 :- Job title Date From To Date to Job Name These are the 3 blocks but i need to add multiple sections dynamically is this possible by phpdocx ? is there any function that help me? Can anyone help me on this topic? Thanks

Posted by admin  · 01-06-2015 - 07:27

Hello, Where do you need to add multiple sections? The addSection method allows to create new sections and the modifyPageLayout method changes the current page layout. If you need to create a new document from more than one template you must use the MultiMerge class available in Corporate and Enterprise licenses. Regards.

Posted by mahendra.s  · 01-06-2015 - 08:01

Hello, I need something like this : - $DateFrom $JobTitle $CompanyName $ResumeActualJob $Responsabilités $Tasks $Tasks $Tasks $Tasks $Tasks $Tasks $Tasks i have to block or section like this multiple times dynamically is there any function to archive this ?

Posted by admin  · 01-06-2015 - 08:34

Hello, You can generate placeholders dinamically and then replace them using the template methods; for example by WordFragments. We recommend you to read the API methods on http://www.phpdocx.com/documentation/api-documentation. Regards.

Posted by mahendra.s  · 01-06-2015 - 08:56

Thanks for your reply i have tried your all methods but didn't get any help from available method that's why i have generate topic i have many variables in a single block Here's seems i have to save variable before replacing variables values because block coming dynamically like this $DateFrom $JobTitle $CompanyName $ResumeActualJob Responsabilités $Tasks $Tasks $Tasks $Tasks $Tasks $Tasks $Tasks if you can help me here that would be better otherwise i have add static variables blocks Thanks

Posted by admin  · 01-06-2015 - 12:05

Hello, What version and license of phpdocx are you using? One important point is that phpdocx needs the placeholder be surrounded by the symbol not just at the beginning; this is $VAR$ not $VAR. Regards.

Posted by mahendra.s  · 01-06-2015 - 12:59

Hello, i am using correct version of phpdocx Yes i am using variables like $var$ but i need structure that i have posted in previous comment is there any possible solution for it? Thanks

Posted by admin  · 01-06-2015 - 13:44

Hello, You need to create a new document (with phpdocx or Word) and using MultiMerge (with the help of addSection/modifiyPageLayout methods if needed) you can generate a new DOCX with dinamically content added. Or you can create a WordFragment with all content and add it as many times as needed. Regards.