In MacOS enviroment,the font is in correct!help
AndyChenrun opened this issue · 1 comments
AndyChenrun commented
Describe your problem
In the MacOS environment, use the docxtpl {{}} method to insert text into the template. Unfortunately, the font is incorrect. How to solve it?
More details about your problem
1.Open template.doc
2. Write data through render method
3. Save the file
AndyChenrun commented
I had tried like below:
from docx import Document
document = Document("example.docx")
for run in document.runs:
run.font.name = "Arial"
run.font.size = Pt(12)
run.font.color.rgb = RGBColor(0x42, 0x24, 0xE9)
document.save("modified_example.docx")
this code does not work fine.