Recent practice need to be adjusted on a number of ppt format, mainly the position title, alignment, font, and so unified, artificial and cumbersome and easy to modify wrong.
Therefore pptx combined package information online, using python script to complete the process.
The main point is that pit, shape of text_frame can not directly modify the fonts, or even paragraph does not work, due to the presence of a box multiple fonts, it will be reported as "None", need to be further modified to run layer.
from PPTX Import the Presentation from pptx.enum.text Import PP_ALIGN PRS = the Presentation ( ' originalppt.pptx ' ) # Import ppt sthead = prs.slides [2] .Shapes [. 1] # to 3 ppt of a standard header format Print ( sthead.text) stleft = sthead.left stwidth = sthead.width sttop = sthead.top stheight = sthead.height # -by modification I =. 1 for Slide in prs.slides: for shape in slide.shapes: if shape.has_text_frame: if 36000<shape.left<1200000 and shape.height<1400000: ftname=(shape.text_frame.paragraphs[0].runs[0].font.name) ftsize=int(shape.text_frame.paragraphs[0].runs[0].font.size.pt) if (ftsize>27): head=shape head.left=stleft head.top=sttop head.width=10080000 head.height=stheight head.text_frame.vertical_anchor = MSO_ANCHOR.MIDDLE head.text_frame.paragraphs[0].line_spacing=1 for paragraph in head.text_frame.paragraphs: for run in paragraph.runs: run.font.size = 32*12700 run.font.name = '宋体' #print(i,'ok') i +=1 prs.save('adjnew.pptx' ) # PPT Save the modified