Forum


Replies: 9   Views: 3758
Rtl lists generation from html
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 nregev  · 12-12-2016 - 22:15

Hello again.

I was working on other files here and found that this solution is somewhat unstable.
Did some further digging and found that if the <li> tag has a text-align style set to "right" then the list item will show on the left after all.

For example, this will create a list item on the left :

<ol>
   <li dir="rtl" style="text-align:right">
      <span>RTL</span>
   </li>
</ol>

For the moment, I've applied the following (somewhat rough, I know) sollution in HTML2WordML :

(added the 'unset' to the solution you've suggested previously)

if ((isset($properties['dir']) && strtolower($properties['dir']) == 'rtl') ||
    (isset($properties['direction']) && strtolower($properties['direction']) == 'rtl')) {
       unset($properties['text_align']);
       $stringListPr .= '<w:bidi w:val="1" />';
}

Will be happy to hear that this (or a better) solution will also be included in the next versions to come :)

Thanks.

Nir.