python pptx更改表位置post h

2024-04-26 14:24:28 发布

您现在位置:Python中文网/ 问答频道 /正文

我将python2.7与pythonptx一起使用。在

我知道创建表时如何确定表的位置:

table = shapes.add_table(rows, cols, left, top, width, height).table

问题是:我需要表格居中,我在创建它之前找不到它的宽度和高度,但是创建之后,当尝试以下代码时,我无法移动它:

^{2}$

这不会改变任何东西。在

我怎么能: 1.在创建表格之前计算/确定表格宽度 2.创建表格后移动表格。在

谢谢


Tags: 代码add宽度高度toptablewidthleft
1条回答
网友
1楼 · 发布于 2024-04-26 14:24:28

表不是具有位置和大小的对象,而是包含它的(图形框架)形状。要更改位置和大小,需要引用该形状:

graphic_frame = shapes.add_table(rows, cols, left, top, width, height)
table = graphic_frame.table
graphic_frame.left = <some number>

相关问题 更多 >