Forum


Replies: 4   Views: 730
Converting html to word, heading tags are automatically set to bold in docx file
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  · 09-12-2022 - 18:54

Hello,

We recommend you read the following documentation pages:

There's no issue when transforming HTML. The default CSS styles (templates/html.css file) used by phpdocx apply bold style to heading tags and other default styles.

If you don't want to apply to some default style (such as bold in HTML heading tags) you can set new styles when transforming HTML. For example:

$html = '
<style>
h1, h2, h3, h4, h5, h6 {
    font-weight: normal;
}
</style>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
';
$docx->embedHTML($html);

Regards.