Forum


Replies: 9   Views: 3752
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  · 09-12-2016 - 17:16

Hi !

I'm embedding HTML lists into a docx document and no matter what I try, the lists always come our LTR.
When viewing the same HTML in a browser things look fine (i.e. RTL).

assume this simple HTML example :

<ul>
   <li>
      aaa
   </li>
   <li>
      bbb
   </li>
</ul>

Things I've already tried (+ combinations of them) :

  • setting the document to RTL using setRTL() function (before / after embedding the HTML)
  • setting the document dir attribute to 'rtl'
  • placing the <ul> tag in a div with style="direction: rtl;"
  • setting a style="direction: rtl;" on the <ul> tag and/or <li> tags
  • setting dir="rtl" on the <ul> tag and/or <li> tags

The only thing that made *some* difference was to set the alignment of the <ul> to 'right' but obviously this yields the wrong results as the text shows up to the right of the list "symbol" (e.g. dot / number) instead of to it's left.

For viewing the docx file I've already tried :

  • MS Word viewer (with the conversion addon)
  • MS Word 2013
  • Libre Office 4.2.8.2

All yielded the same results.

Any clues on how to solve this ??

Thanks.