Quantcast
Channel: PHPWord
Viewing all articles
Browse latest Browse all 450

Commented Unassigned: Template setValue doesn't work with values contain '&' [68]

$
0
0
I was try with sample Template.php in download packet with value contain '&' and get error "Illegal name character."

$PHPWord = new PHPWord();

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

$document->setValue('Value1', 'Sun abc/123 & 4');
$document->setValue('Value2', 'Mercury & Test');
$document->setValue('Value3', 'Venus');
$document->setValue('Value4', 'Earth');
$document->setValue('Value5', 'Mars');
$document->setValue('Value6', 'Jupiter');
$document->setValue('Value7', 'Saturn');
$document->setValue('Value8', 'Uranus');
$document->setValue('Value9', 'Neptun');
$document->setValue('Value10', 'Pluto');

$document->setValue('weekday', date('l'));
$document->setValue('time', date('H:i'));

$document->save('Solarsystem.docx');

Maybe a bug here. Any help would be great
Comments: I believe this solution is correct to your issue. Please update when possible. Handling special characters like that is something you should get accustomed to, especially if sourcing data/documents from multiple platforms (Mac,Linux,Windows).

Viewing all articles
Browse latest Browse all 450

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>