I have a working docx generator which works fine for European languages, and I'm trying to add complex script support. I found another question with some recipes to try: python-docx add_style with CTL (Complex text layout) language
I managed to get it working so that complex-script text comes out in the correct typeface and size, but I can't get bidirectional (right-to-left) text working. The obvious "x.font.rtl = True" doesn't work, and neither does the spell given in the other post ("lang.set(qn('w:bidi'),'fa-IR')"). I had to take out the line " "rpr.get_or_add_sz()" from his recipe, which left me with an unreadable file, but everything else works without it and I don't think that it's related to this problem.
Here is the style as it appears in the generated document's styles.xml file:
<w:style w:styleId="Hebrew" w:type="paragraph" w:customStyle="1">
<w:name w:val="Hebrew"/>
<w:basedOn w:val="Normal"/>
<w:pPr>
<w:jc w:val="right"/>
</w:pPr>
<w:rPr>
<w:rFonts w:cs="Arial"/>
<w:rtl/>
<w:szCs w:val="24"/>
<w:lang w:bidi="he-IL"/>
</w:rPr>
</w:style>
Can anyone advise me on what to do to get paragraphs in right-to-left languages working?