Okay so I'm using PHPWord creating a template. Then using the function setValue to replace the different strings in the document this all works correctly but I have a cover page on my document and the text is not replaced on this page?
Is there a way to add this functionality, In essence all that needs to happen is the replace (setValue) needs to run on the xml that corresponds to the cover page (title, and assets)(custom xml folder?). you can see these by extracting the .docx file after changing the file extension to .zip
https://github.com/PHPOffice/PHPWord/blob/master/src/PhpWord/Template.php
How I'm currently creating the .docx from the templated .docx file:
<?php
include_once 'Sample_Header.php';
// New Word document
echo date('H:i:s') , " Create new PhpWord object" , EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$document = $phpWord->loadTemplate('resources/Template_Proposal.docx');
$document->setValue('CONTACTNAME', 'John');
$document->setValue('BUSINESSNAME', 'JBS Marketing');
$document->setValue('WEBSITE', 'www.website.com.au');
$document->setValue('DATE', '07/07/2014');
$name = 'test-proposal.docx';
echo date('H:i:s'), " Write to Word2007 format", EOL;
$document->saveAs($name);
rename($name, "results/{$name}");
echo getEndingNotes(array('Word2007' => 'docx'));
if (!CLI) {
include_once 'Sample_Footer.php';
}