Forum


Replies: 1   Views: 519
Format images 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 adiXelp  · 13-05-2021 - 16:25

I have html content coming in from ckeditor, I pass this content to embedHTML() with strictWordStyles as true and apply paragragh and character styling, is there a way that I can apply image styles for images coming in the content? I am looking to keep a constant height and width of images for entire document.

Posted by admin  · 13-05-2021 - 19:11

Hello,

If you are setting strictWordStyles as true then most CSS styles are not applied (https://www.phpdocx.com/api-documentation/word-content/embed-html-Word-document-with-PHP):

strictWordStyles  bool    If true ignores almost all CSS styles and uses the styles set via the wordStyles option (see next).

You'd need to use width and height attributes instead of CSS styles. Or use HTML Extended and CSS Extended: https://www.phpdocx.com/documentation/introduction/html-extended-to-word-PHP, but this feature is available only in Premium licenses.

On https://www.phpdocx.com/htmlapi-documentation/html-standard/insert-image-Word-document-with-HTML you can read more information about working with img tags and the available styles and attributes.

Regards.