Hello,
You can use that property with paragraphs and cells, not with span tags. If you want to use div tags a p tags, you need to enable the parseDivsAsPs option (https://www.phpdocx.com/api-documentation/word-content/embed-html-Word-document-with-PHP).
These are the available values for that option:
- lrTb Left to Right, Top to Bottom
- tbRl Top to Bottom, Right to Left
- btLr Bottom to Top, Left to Right
- lrTbV Left to Right, Top to Bottom Rotated
- tbRlV Top to Bottom, Right to Left Rotated
- tbLrV Top to Bottom, Left to Right Rotated
This is a simple sample that set tbRl as text direction for one cell content in a table:
$html = '<table border="1" style="border-collapse: collapse" width="600">
<tbody>
<tr width="600">
<td style="background-color: yellow">1_1</td>
<td rowspan="3" colspan="2" dir="tbRl">Rotated text</td>
</tr>
<tr width="600">
<td>Some random text.</td>
</tr>
<tr width="600">
<td>
<ul>
<li>One</li>
<li>Two <b>and a half</b></li>
</ul>
</td>
</tr>
<tr width="600">
<td>3_2</td>
<td>3_3</td>
<td>3_3</td>
</tr>
</tbody>
</table>';
$docx->embedHTML($html);
You can also use custom paragraphs styles.
Regards.