Create document issue

Sep 22, 2012 at 8:17 PM

I just downloaded the code what would make me happy if I could get it to work. So I'm trying to make  a word document on flow wit posted php variables using a template and my php code as it follows

 

require_once 'PHPWord.php';

$PHPWord = new PHPWord();

$document = $PHPWord->loadTemplate('praemie.docx');

$document->setValue('Name', utf8_encode($_POST['name']));
$document->setValue('Vorname', utf8_encode($_POST['vorname']));
$document->setValue('Street', $_POST['street']);
$document->setValue('Zip', $_POST['zip']);
$document->setValue('City', $_POST['city']);

and in the template docx I call those variabes as ${Name} ${Vorname} but they don't display. What I makeing wrong

Sep 24, 2012 at 2:55 AM

What about replacing the original datas in Template.php like this

 

$document->setValue('Value1', 'Sun');
$document->setValue('Value2', 'Mercury');
$document->setValue('Value3', 'Venus');
$document->setValue('Value4', 'Earth');
$document->setValue('Value5', 'Mars');
$document->setValue('Name', utf8_encode($_POST['name']));
$document->setValue('Vorname', utf8_encode($_POST['vorname']));
$document->setValue('Street', $_POST['street']);
$document->setValue('Zip', $_POST['zip']);
$document->setValue('City', $_POST['city']);