Cookbook

Change the base template and its default styles

phpdocx uses a base template with default styles. The library uses them when the user doesn’t indicate explicit values, e.g., default sizes for paragraphs and headings.

You can modify these initial values easily with the parameters available for each method of the API or using the setDocumentDefaultStyles method. However, you can change them too with a base template of your own by instantiating the class CreateDocx.

The following code defines a custom base template: