This project is read-only.

setValue() broken

Jul 2, 2013 at 10:18 PM
Edited Jul 2, 2013 at 10:18 PM
here is my php code:
$PHPWord = new PHPWord();
$template = $PHPWord->loadTemplate(APPPATH.'files/test.docx');
$template->setValue('test1', 'hello');
$template->setValue('test2', 'whats');
$template->setValue('test3', 'up');
$template->setValue('test4', 'koby');
$template->setValue('test5', '!!!!!!');
$template->save('files/test.docx');
here is my word document text:

${test1}
${test2}
${test3}
${test4}
${test5}

The output word content:

hello
${test2}
${test3}
${test4}
${test5}

setValue(); only sets the value for the first line ${test1}

Any help would be great
Jul 5, 2013 at 2:02 PM
You need to type "${test1} ${test2} ${test3} ${test4} ${test5}" on your template manually, not copy/paste. Encountered this just recently. Hope this helps.