2016-11-16 40 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>