Replies: 9   Views: 2526
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 );


Resulted Output: