Forum


Replies: 9   Views: 2645
How to add two addmergefields on same line?
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 sbhosale  · 25-07-2017 - 09:02

I want to add multiple merge fields in doc file but addMergeField() adds merge field on new line. How can it be achieve?

 

Expected Output:

Dear <<first_name>> <<last_name>>,

 

My code:

$Docx->addText('Dear ');

$Docx->addMergeField( 'first_name', $arrmixMergeParameters, $arrmixOptions );

$Docx->addMergeField( 'last_name', $arrmixMergeParameters, $arrmixOptions );

$Docx->addText(',');

Resulted Output: 

Dear

<<first_name>>

<<last_name>>

,

 

 

 

Posted by admin  · 25-07-2017 - 17:20

Hello,

Which version and license of phpdocx are you using?

Regards.

Posted by sbhosale  · 26-07-2017 - 02:58

I am using trail version as I want to check functionality for merge fields. I am planning to buy basic version.

Posted by sbhosale  · 01-08-2017 - 10:31

Hi,

Thanks for suggestion. I used WordFragment class but this class skips merge fields but working well for other objects like image, link etc.

Please help.

 

Thanks

Posted by admin  · 01-08-2017 - 13:43

Hello,

We have done some quick tests and everything is working fine. After you have purchased a license please contact us again and we'll send you a detailed example that illustrates how to do it.

Regards.

Posted by sbhosale  · 24-08-2017 - 08:32

Can you please provide demo? 

Posted by admin  · 24-08-2017 - 09:31

Hello,

Which license and version of phpdocx are you using?

Regards.

Posted by sbhosale  · 24-08-2017 - 10:27

I am using version 7 and advanced licence 

Posted by admin  · 24-08-2017 - 10:36

Hello,

Your user doesn't have any license tied. Please send to contact[at]phpdocx.com the username or email of the user that has purchased the license and the key license you are using.

Regards.