使用 python3 更改 word 中的字体方向
change font direction in word with python3
我想从一个word文档中获取一段文字,对其进行一些修改,然后将其放入一个新的word文档中
如何将方向更改为右上角并将字体大小更改为 35
from docx import Document
doc = Document("nameOfTheFile.docx")
doc2 = Document()
n = 0
for p in doc.paragraphs:
n += 1
# doc2.add_paragraph(p.text)
print(n)
doc2.save("nameOfTheFileEdited.docx")
你可以使用这个 -
还有refer-
import docx
from docx.shared import Pt
doc = docx.Document('file_name.docx')
doc1 = docx.Document()
style = doc1.styles['Normal']
font = style.font
font.rtl = True
font.size = Pt(35)
for paragraph in doc.paragraphs:
parag = doc1.add_paragraph()
parag.add_run(paragraph.text)
doc1.save('new_file.docx')
我想从一个word文档中获取一段文字,对其进行一些修改,然后将其放入一个新的word文档中
如何将方向更改为右上角并将字体大小更改为 35
from docx import Document
doc = Document("nameOfTheFile.docx")
doc2 = Document()
n = 0
for p in doc.paragraphs:
n += 1
# doc2.add_paragraph(p.text)
print(n)
doc2.save("nameOfTheFileEdited.docx")
你可以使用这个 -
还有refer-
import docx
from docx.shared import Pt
doc = docx.Document('file_name.docx')
doc1 = docx.Document()
style = doc1.styles['Normal']
font = style.font
font.rtl = True
font.size = Pt(35)
for paragraph in doc.paragraphs:
parag = doc1.add_paragraph()
parag.add_run(paragraph.text)
doc1.save('new_file.docx')