I have created a new docx from template with mulitple variables.
Then, in the new docx, i need to add an external templates (this is working fine)
$docx->replaceVariableByExternalFile(array('EXTERNALFILE' => public_path() . '/templates/external file.docx'), array('matchSource' => true));
But now, I need to replace variable by text in the external file.
I have already tried to :
1. create an array for the external files variables :
$variableForExternaFile = array(
'TIMEESTIMATED' => $request->get('DescriptionSheet')['timeEstimated'],
'HOURLYRATE' => $request->get('PriceInfo')['hourPrice'],
'TOTALCOST' => $request->get('PriceInfo')['totalCoast'],
'DISCOUNT' => $request->get('PriceInfo')['reductionAmount'],
'HOURLYRATEDISCOUNT' => $request->get('PriceInfo')['hourlyRateDiscounted']
);
2. create a second docx from template for the external file
$externalFile = new CreateDocxFromTemplate(public_path() . '/templates/external file.docx');
3. replace the variable by text in the external files
$externalFile ->replaceVariableByText($variableForExternaFile );
4. finally replaceVariableByExternalFile in the new docx (external files)
$docx->replaceVariableByExternalFile(array('EXTERNALFILE' => $externalFile ), array('matchSource' => true));
But not working.
Do I have a solution with phpdocx?