I am creating a table using pptx python
Reference: https://python-pptx.readthedocs.io/en/latest/dev/analysis/tbl-table.html
When I create a table, I get the default table style and I would like to change it. Any recommendation?
x, y, cx, cy = Inches(4.5), Inches(1.5), Inches(4.0), Inches(0)
shape = slide.shapes.add_table(7, 5, x, y, cx, cy)
table = shape.table
I am thinking of table.apply_style()
but I can't figure out the correct syntax
Ok found the solution
x, y, cx, cy = Inches(4.5), Inches(1.5), Inches(4.0), Inches(0)
shape = slide.shapes.add_table(7, 5, x, y, cx, cy)
table = shape.table
tbl = shape._element.graphic.graphicData.tbl
style_id = '{1FECB4D8-DB02-4DC6-A0A2-4F2EBAE1DC90}'
tbl[0][-1].text = style_id
I am using Medium Style 1 Accent 3, Replace the sytle_id
with the GUI found in this list: https://github.com/scanny/python-pptx/issues/27#issuecomment-263076372