PHPWord
PHPWord copied to clipboard
How to change font size when using TemplateProcessor?
Is it possible to change font size when using TemplateProcessor?
I was try to do this, but not working.
$template = new PhpOffice\PhpWord\TemplateProcessor('template.docx');
$template->setValues([
'name' => 'Nur Muhammad',
'country' => 'Indonesia'
]);
$template->saveAs('result1.docx');
// Try to change the font size
$phpword = PhpOffice\PhpWord\IOFactory::load('result1.docx');
$phpword->setDefaultFontSize(9);
$phpword->save('result2.docx');
The problem I get:
- The document styles is lose
- The font size not change
Thanks in advance.