python-docx add_style with CTL (Complex text layout) language

后端 未结 2 1271
天涯浪人
天涯浪人 2020-12-20 00:37

What I’m trying to accomplish:

  • Create a paragraph style in python-docx with user defined Persian font and size (a CTL language)

2条回答
  •  南方客
    南方客 (楼主)
    2020-12-20 01:21

    I had a similar problem and added the support to the docx library. The forked docx code is in https://github.com/Oritk/python-docx Usage:

    run = p.add_run(line)
    #ru.font.size = Pt(8) ### This line is redundant - but you can leave it
    run.font.cs_size = Pt(8)
    run.font.rtl = True
    

提交回复
热议问题