Forum


Replies: 2   Views: 1140
Embedhtml renders h* with bold character style
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 pwctechnicalsecurity  · 03-04-2021 - 09:05

Hi,

embedHTML renders all headers with bold characterstyle.

See the snippet below. How can I ensure that this is not the case?

The issue is present in our own template, as well as test.docx (which is basically a brand new Word default template). In itself the default template has no bold style, yet this snippet renders it as bold.

Any suggestions?

require_once '../../../Classes/Phpdocx/Create/CreateDocx.php';

$docx = new Phpdocx\Create\CreateDocxFromTemplate('test.docx');

$html = '<h1>An embedHTML() example</h1>';
$html .= '<h2>Test</h2>';
$html .= '<h3>Test</h3>';
$html .= '<h4>Test</h4>';
$html .= '<h5>Test</h5>';
$html .= '<h6>Test</h6>';

$docx->embedHTML($html, array(
    'strictWordStyles' => true,
    'wordStyles' => array(
        '<h1>' => 'Heading1',
        '<h2>' => 'Heading2',
        '<h3>' => 'Heading3',
        '<h4>' => 'Heading4',
        '<h5>' => 'Heading5',
        '<h6>' => 'Heading6'
    )
));

$docx->createDocx('issue');