Forum


Replies: 2   Views: 669
How can i transform word to html from internal to inline 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 poominb  · 20-07-2022 - 14:19

I have Premium licenses, so i want to transform word (.docx) to html with inline style (bold, italic, etc.). i try with transformDocAdvHTML but it will add style to internal. how can i change to inline style. 

Posted by admin  · 20-07-2022 - 14:23

Hello,

DOCX to HTML transforms styles as CSS styles (using style tags), not as inline styles. If you need inline styles, we recommend you to use an external library or program to transform the HTML output returned by phpdocx. On https://www.phpdocx.com/documentation/cookbook/wysiwyg-editor you can read this same recommendation:

phpdocx transforms DOCX to HTML, generating non inline CSS styles by using style tags. Some WYSIWYG editors require using inline styles. In these cases, it is advisable to convert the HTML obtained with phpdocx to an HTML with inline styles. There are many tools and libraries fit for this purpose, including native PHP solutions: https://stackoverflow.com/questions/3990706/php-class-to-inline-css-styles

Regards.

Posted by poominb  · 20-07-2022 - 14:54

Thank you so much for the informative answer, sovles by use emogrifier (external library) to converts CSS styles into inline style attributes in HTML code.