i'm using vscode 1.87.2 and spire.doc 12.3.2 to devlope my code
i want to add a combition of rtl(persian/arabic) and ltl text(english) text in word but it dosent work correctly?
ther first problem is vscode doesnt support rtl langue so i used arabic_reshaper
but the problem is when the text is more than one line for exp. one and half the problem is the first part of text befor english text seperate into two part and first part goes to second line
but it didnt for second text beacuse its more than one line
here is my code
- Code: Select all
import arabic_reshaper
from bidi.algorithm import get_display
from spire.doc import *
from spire.doc.common import *
"""
اول second سوم
اول اول اول اول اول دوم اول اول اول اول اول اول اول اول اول اول اول اول اول sssecondddddddd سوم سوم سوم سوم سوم سوم سوم سوم سوم
"""
text = 'اول اول اول اول اول دوم اول اول اول اول اول اول اول اول اول اول اول اول اول sssecondddddddd سوم سوم سوم سوم سوم سوم سوم سوم سوم'
# Create a Document object
document = Document()
# Add a section
section = document.AddSection()
paragraph = section.AddParagraph()
paragraph.Format.IsBidi = True
paragraph.Format.HorizontalAlignment = HorizontalAlignment.Left
paragraph.AppendText(text)
text = arabic_reshaper.reshape(text)
text = get_display(text)
print(text)
paragraph = section.AddParagraph()
paragraph.Format.IsBidi = True
paragraph.Format.HorizontalAlignment = HorizontalAlignment.Left
paragraph.AppendText(text)
path = "output/test.docx"
document.SaveToFile(path)
here u can find video i provided to wahts the problem
https://drive.google.com/file/d/1qmcb8WHa99WElSuziB7xL5iuwWjS8rtE/view?usp=drive_link