如何使用 pptx python 更改默认 table 样式?
How to change default table style using pptx python?
我正在使用 pptx python
创建 table
参考:https://python-pptx.readthedocs.io/en/latest/dev/analysis/tbl-table.html
当我创建 table 时,我得到了默认的 table 样式,我想更改它。有什么推荐吗?
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
我正在考虑table.apply_style()
,但我想不出正确的语法
确定找到解决方案
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
我正在使用 Medium Style 1 Accent 3,将 sytle_id
替换为在此列表中找到的 GUI:https://github.com/scanny/python-pptx/issues/27#issuecomment-263076372
我在 https://github.com/mbachtell/python-pptx-table-styles 上展示了每个 table 风格的幻灯片。
如果其他人遇到此需求。
我正在使用 pptx python
创建 table参考:https://python-pptx.readthedocs.io/en/latest/dev/analysis/tbl-table.html
当我创建 table 时,我得到了默认的 table 样式,我想更改它。有什么推荐吗?
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
我正在考虑table.apply_style()
,但我想不出正确的语法
确定找到解决方案
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
我正在使用 Medium Style 1 Accent 3,将 sytle_id
替换为在此列表中找到的 GUI:https://github.com/scanny/python-pptx/issues/27#issuecomment-263076372
我在 https://github.com/mbachtell/python-pptx-table-styles 上展示了每个 table 风格的幻灯片。
如果其他人遇到此需求。