Forum


Replies: 3   Views: 180
Replacevariablebyhtml css not applying

Posted by admin  · 26-02-2024 - 15:19

Hello,

Please note that the addDefaultStyles option prevents adding some styles. Also please note that the placeholder names to be replaced don't include the template symbols.

Please use the following code:

$placeholder = 'EXAMPLE';

$testValue = '<style>p {color:red; font-weight:bold;}></style><p>Test HTML</p>';

$docx->replaceVariableByHTML($placeholder, 'inline', $testValue);

All styles must be applied correctly now.
If you send to contact[at]phpdocx.com the template you are using, we can generate a custom code using it.

Regards.