我无法使用 python-docx 库将文本方向(注意:不是文本对齐)设置为从右到左。你有解决这个问题的想法吗?
from docx import Document
from docx.enum.style import WD_STYLE_TYPE
from docx.enum.text import WD_TAB_ALIGNMENT,WD_PARAGRAPH_ALIGNMENT
doc = Document()
style = doc.styles.add_style('rtl', WD_STYLE_TYPE.CHARACTER)
style.font.rtl = True
paragraph = doc.add_paragraph()
paragraph.paragraph_format.alignment = WD_PARAGRAPH_ALIGNMENT.RIGHT
paragraph.add_run('تست Test تست Test',style = "rtl")
doc.save('test.docx')