我想实现,从图片1到图片2的边框效果,即实现由无色到黑色的转变;我添加table语句:blank_slide_layout = self.prs.slide_layouts[4]
slide = self.prs.slides.add_slide(blank_slide_layout)
shapes = slide.shapes
inputpd = inputpd.sort_values('激励点及方向')
DataListNumber = len(inputpd.index)
rows = DataListNumber + 2
cols = len(self.vtf_sum_header) -2
left = Cm(1.51)
top = Cm(3.56)
width = Cm(26.68)
height = Cm(12.62)
table = shapes.add_table(rows, cols, left, top, width, height).table
from pptx.oxml.xmlchemy import OxmlElement
def SubElement(parent, tagname, **kwargs):
element = OxmlElement(tagname)
element.attrib.update(kwargs)
parent.append(element)
return element
def _set_cell_border(cell, border_color="000000", border_width='12700'):
tc = cell._tc
tcPr = tc.get_or_add_tcPr()
for lines in ['a:lnL','a:lnR','a:lnT','a:lnB']:
ln = SubElement(tcPr, lines, w=border_width, cap='flat', cmpd='sng', algn='ctr')
solidFill = SubElement(ln, 'a:solidFill')
srgbClr = SubElement(solidFill, 'a:srgbClr', val=border_color)
prstDash = SubElement(ln, 'a:prstDash', val='solid')
round_ = SubElement(ln, 'a:round')
headEnd = SubElement(ln, 'a:headEnd', type='none', w='med', len='med')
tailEnd = SubElement(ln, 'a:tailEnd', type='none', w='med', len='med')