Replies: 7   Views: 1479
How to create heading with formatstyles in embedhtml?
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  · 14-12-2020 - 15:47



If you run

$docx->addText('Contents',array('pStyle' => 'Heading1'));

and you don't get a custom paragraph style applied to that content is because your DOCX doesn't include that style name (Heading1). Please test and run the included sample Core/addTableContents/sample_2.php that applies custom paragraph styles included in the default template of phpdocx, for example:

$docx->addText('Chapter 1', array('pStyle' => 'Heading1PHPDOCX'));

If you don't know the name of the style/s you want to apply, you can get them using importStyles ( On you can read the practical guide about using styles with phpdocx.