Forum


Replies: 4   Views: 697
Customizewordcontent + 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 admin  · 18-10-2022 - 14:35

Hello,

It's working correctly. Please run the following simple code:

$docx = new CreateDocx();

$html = '<p><img src="image.png" width="90" height="90"></p>';
$docx->embedHTML($html, ['useHTMLExtended' => true]);

$docx->customizeWordContent(['type' => 'image'], ['imageAlign' => 'center']);

$docx->createDocx('output');

HTML sets a default left align. Then the customizeWordContent method sets a center align to the image.

Maybe your HTML is floating the image, so MS Word ignores the alignment, or some other parent style of the image is applying another alignment to the image.

Regards.