DOCXCustomizer is a functionality available for Premium licenses only. It includes the public method customizeWordContent, which changes the content styles of new documents and templates on the fly.
DOCXCustomizer supports dozens of styles for all the most common contents of a document: breaks, images, lists, paragraphs, run of texts, sections, styles, tables...
The signature used by this method is the following:
The method uses two parameters:
- $referenceNode: a reference of the content you want to change. It is indicated with a query with the DOCXPath syntaxis.
- $options: an array of the styles you want to apply.
The following script creates a DOCX with two paragraphs, and using the customizeWordContent method it changes on the fly the styles of the paragraph that contains the text "Sed tu", adding a background colour, bold text, a new font family and a new font size.
You can change templates too with customizeWordContent. Let's modify now the level of an item in a list as an example of this:
Orientation and sizes of a specific section can be altered too:
Almost all styles of every content existing in a Word document can be customized with the customizeWordContent method, such as paragraph styles, column sizes, borders, colours, aligns, sizes, spacings...
You can check all options available for DOCXCustomizer in its API documentation.