Forum


Replies: 3   Views: 1938
How can i change the font of a template?
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by jeremie  · 23-03-2020 - 10:47

OK it works with Premium Edition.

One thing that doesn't work though is 'type' => '*' in order to apply the new font to all the document.

 

The following doesn't work:

$docx->customizeWordContent(['target' => 'document', 'type' => '*', 'contains' => '',], ['font' => 'Calibri']);

So I have to loop throught all possible types, like this:

foreach (array('break', 'image', 'list', 'paragraph', 'run', 'section', 'style', 'table', 'table-row', 'table-cell') as $type)
        $docx->customizeWordContent(['target' => 'document', 'type' => $type, 'contains' => '',], ['font' => 'Calibri']);