Hello,
UPDATE: Working with headings using PHP methods and HTML contents
To use other style names than the default ones, you can use a custom template (with data or empty) or generate the styles dynamically with phpdocx methods. If you want to use the default MS Word style names (that don't have always names such as Heading1, because style names may depend on the DOCX program used to generate the document and the language of the DOCX editor), you can create an empty template (with MS Word or other DOCX program) and open it with the CreateDocxFromTemplate class:
$docx = new CreateDocxFromTemplate('template.docx');
CreateDocxFromTemplate inherits CreateDocx, so you can use the methods available in both classes.
Using the parseStyles method you can generate a DOCX with the existing styles in the template. And also use importStyles to import styles from an external DOCX if needed.
As you are using the trial package, we recommend you to read the documentation available, for example on the Practical guide: https://www.phpdocx.com/documentation/practical. If you purchase a license, do not hesitate to send an email to contact[at]phpdocx.com, we'll generate a custom template and script that illustrates how to use an empty template and its styles if needed.
Regards.