Search code examples
pythonpython-pptx

Table height of insert_table in python-pptx


I use python-pptx and created a table with insert_table at the position of a placeholder.

ph = slide.placeholders[11]
table = ph.insert_table(rows=6,cols=1).table

Is it possible to make the table fit the height of the placeholder? Alternatively, is it possible to define an overall table height for this table?

I know you can define a table height when using add_table. However, are there also solutions for insert_table?


Solution

  • The short answer is you're on your own for that.

    You'd want to divide the placeholder vertical size by the number of rows and set each row height to that.