[code]
require_once 'Phpdocx/classes/CreateDocx.inc';
foreach($data as $key => $value){
$docx = new CreateDocx();
$docx->addTemplate('templates/envelope_template.docx');
$docx->addTemplateVariable('RETURN_NAME', $value);
$docx->addTemplateVariable('SENDER_NAME', $value);
$docx->createDocx('envelope_merge_' . $key);
}
$docx = new CreateDocx();
foreach($data as $key => $value){
$docx->addDOCX('envelope_merge_' . $key . '.docx');
$docx->addBreak('page');
}
$docx->createDocx('batchfile');
[/code]