I'm using the python‑pptx library to generate PowerPoint presentations on a Linux environment (Python 3.10). I need to add text to the slides, but it must display from right to left (RTL). I have tried the following approaches:
Setting RTL on font runs:
I attempted to set the RTL property with:
run.font.rtl = True
However, this does not change the text direction as expected.
Prepending a Unicode Right-to-Left mark:
I added the Unicode control character \u200F to the beginning of the text, e.g.
text_frame.text = "\u200F" + "lalala"
Unfortunately, the text still appears in LTR order.
Adjusting paragraph alignment:
I set the paragraph alignment to right using:
p.alignment = 2
Yet, this only changes the alignment, not the underlying RTL behavior.
I have also experimented with directly modifying the underlying XML within the PPTX file, but I haven’t been able to achieve consistent results.
Has anyone encountered this issue with RTL text in python‑pptx? What are the recommended workarounds (including any XML editing techniques) to force a presentation generated with python‑pptx to display text in proper RTL format?
Thank you in advance for your help!