Forum


Replies: 6   Views: 666
Setdefaultfont method on existing document text
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 admin  · 27-05-2022 - 12:41

Hello,

Please note that as explained in our previous reply, the setDocumentDefaultStyles method changes the default styles of a DOCX document (w:pPrDefault and rPrDefault tags in docDefaults style [http://officeopenxml.com/WPstyleDefaults.php]). This method doesn't  change custom styles or inline styles.

If the styles to be changed are applied using a custom/type style or as inline styles, DOCXCustomizer must be used.

In a DOCX document the styles work following a hierarchy: theme -> default styles -> type styles -> custom styles -> inline styles. As you are working with a DOCX template you need to use the proper method to update the needed style. In the package you can find many samples that illlustrate how to use DOCXCustomizer.

Also note that CreateDocxFromTemplate extends CreateDocx, so all methods available in CreateDocx are also available using CreateDocxFromTemplate.

Regards.