TOP Aligns text to top of text frame and inherits its value from its layout placeholder or theme. MIDDLE Centers text vertically BOTTOM Aligns text to bottom of text frame MIXED Return value only; indicates a combination of the other states.
CENTER Center align DISTRIBUTE Evenly distributes e.g. Japanese characters from left to right within a line JUSTIFY Justified, i.e. each line both begins and ends at the margin with spacing between words adjusted such that the line exactly fills the width of the paragraph. JUSTIFY_LOW Justify using a small amount of space between words. LEFT Left aligned RIGHT Right aligned THAI_DISTRIBUTE Thai distributed MIXED
Return value only; indicates multiple paragraph alignments are present in a set of paragraphs.
# 保存ppt ppt.save('4.1.2 设置文字框与字体样式.pptx')
4.2 python-pptx 添加表格并设置样式
from pptx import Presentation from pptx.util import Pt,Cm from pptx.dml.color import RGBColor from pptx.enum.text import MSO_ANCHOR from pptx.enum.text import PP_ALIGN
# 遍历所有内容 for shape in slide0.shapes: # 打印shape名称 print(shape.shape_type) # 判断是否为表格 if shape.shape_type == MSO_SHAPE_TYPE.TABLE: #获取表格行 for row in shape.table.rows: for cell in row.cells: print(cell.text_frame.text)