2016-11-16 68 views
0

我使用python 2.7与python pptx。python pptx change table location post hok

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

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

的问题如下:我需要的表为中心,我无法找到它的宽度和高度之前,我创建,但创建后,我无法移动它,当尝试下面的代码:

table.left = <some number> 

这不会改变任何东西。

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

由于

回答

1

表不与位置和大小的对象,而它是(图形帧)形状包含它。要更改位置和大小,您需要参考该形状:

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