Hi. I am using HTML to DOCX conversion. How to do something similar to "clear: both;" property in CSS? I need to have an export exactly the case as in HTML - http://joxi.ru/p279K0MtKgaBLr
Hi. I am using HTML to DOCX conversion. How to do something similar to "clear: both;" property in CSS? I need to have an export exactly the case as in HTML - http://joxi.ru/p279K0MtKgaBLr
Hello,
There's no equivalence in MS Word documents to clear: both. If you create a DOCX and then add an image, you can check you need to add line breaks to get that output (https://answers.microsoft.com/en-us/msoffice/forum/all/how-to-make-a-paragraph-stand-clear-of-floating/11a525d5-0d0c-402f-a8bb-0ef21accb619) or use absolute values to position the images.
Although you can do this task using phpdocx_image from HTML Extended, you'd need to use absolute values and it's a complex task. The easiest solution is using tables to get that output (hiding the borders if needed):
$html = '
<style>
td {
vertical-align: top;
}
</style>
<table>
<tr>
<td width="200px;">
<img src="image.png">
</td>
<td width="400px;">
Lorem ipsum
</td>
</tr>
</table>
<table>
<tr>
<td width="300px;">
<img src="imageb.png">
</td>
<td width="300px;">
Lorem ipsum
</td>
</tr>
</table>
';
$docx->embedHTML($html);
Regards.