Forum


Replies: 1   Views: 912
Adddefaultstyles: where are the styles drawn from?
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  · 16-08-2021 - 20:45

Hello,

Firt, we must say that the mixPlaceholderStyles option in the replaceVariableByHTML method is available since phpdocx 11 (https://www.phpdocx.com/news/post/phpdocx-v11-release-notes/222), it's not available in phpdocx 10. Please check if you are using phpdocx 11 Premium; otherwise, that option is not available.

About your question, maybe your issue comes from using mixPlaceholderStyles in placeholders that already have those styles (if using phpdocx 11) or your code is not overwritting the default styles correctly (in template/html.css or the contents you are adding).
By default, the addDefaultStyles option is true; it can be set as false to avoid adding default styles in the very specific cases that is needed.
The library handles some styles automatically, such as font-size, to do the transformations correctly, so the strictWordStyles option may be needed to avoid not adding them when needed. Using the stylesReplacementType option you can mix and use styles from placeholders and HTML.

The easiest approach is applying the styles to be used in the CSS you are adding instead of removing the default ones.

As your other topic, we'd need to check your template and HTML you are adding for futher support and be able to generate a custom script. In addition to know if you are using phpdocx 11 or phpdocx 10 and the correct options for the version you are using.

Regards.