[Python] How to rewrite the table style with python-pptx [python-pptx]
Overview
- I want to create automatic pptx with python.
- I don't like the style of the table, so I want to change it!
- Why doesn't it work while looking at the document? .. ..
problem
- Even if I referred to github, it didn't work.
- Why is there no
shape._element
in the first place?
Solution
- You can change the style to your liking by picking up the UUID from github and replacing it.
table = slide.shapes.add_table(rows, cols, table_left, table_top, table_width, table_height).table
tbl = table._graphic_frame.element.graphic.graphicData.tbl
style_id = '{E8B1032C-EA38-4F05-BA0D-38AFFFC7BED3}' #See github for UUID
tbl[0][-1].text = style_id
Summary
- In order to reduce business hours, I got stuck in the design even though it was automated, and as a result I increased it.
- If it helps those who are worried ...