Replies: 6   Views: 194
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 - 11:03


The setDefaultFont method sets the default font in the theme scope of a DOCX document. This is an internal setting that sets the default font to be used in a DOCX unless other font is applied to the content; this method is useful when creating a DOCX from scratch. Default styles, custom styles and internal styles overwrite this internal setting.

This method doesn't change the font used by contents if some other style is applied, only that specific internal theme setting. If you need to change styles in a DOCX template you need to use DOCXCustomizer, available in Premium licenses.

The setDocumentDefaultStyles method changes default styles of a DOCX document.

Which method to be used depends on the style type to be changed.