Forum


Replies: 1   Views: 2074
Change font-size for document
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 lyudmila_456  · 13-08-2020 - 15:04

Hi. I've seriously issue. Uses a basic version 6.5.
I create a document from a template and for the default sizes this works. But I had to resize (modifyPageLayout) the page to small sizes 1200px x 700px (used custom option). My template has a big font size for text. How I can change font size for all content? Now I see result as 5 empty pages insteead 2 and without content. Thanks! 

Posted by admin  · 13-08-2020 - 15:45

Hello,

Changing font sizes on-the-fly of existing documents depends on how they are set.

If they are set using only the default style, you can use setDefaultFont (https://www.phpdocx.com/api-documentation/layout-and-general/set-default-font-Word-document-with-PHP) or setDocumentDefaultStyles (https://www.phpdocx.com/api-documentation/layout-and-general/set-document-default-styles-Word-document-with-PHP). setDocumentDefaultStyles is available since phpdocx 8.0, we recommend you to upgrade your license to be able to use this method.

If font sizes are set as custom styles or run-of-content styles, then you need to use DOCXCustomizer (https://www.phpdocx.com/api-documentation/docxcustomizer/customize-docx-Word-documents-PHP), but it's only available in Premium licenses.

Regards.