段落缩进

from  docx import  Document
from  docx.shared  import Pt,Inches   #Pt指镑(int类型),Inches指英寸(float类型)


w=Document(r'D:\word练习\练习.docx')
for  paragraph  in  w.paragraphs:
    if  paragraph.style.name=='Normal':
        #paragraph.paragraph_format.space_before=Pt(18)
        #paragraph.paragraph_format.space_after=Pt(10)
        #paragraph.paragraph_format.left_indent=Inches(3)   #左缩进
        paragraph.paragraph_format.first_line_indent=Inches(0.3)   #Inches里面是正数就首行缩进,负数就悬浮缩进
w.save(r'D:\word练习\缩进.docx')

 

你可能感兴趣的:(段落缩进)