Search code examples
pythonpython-pptx

pptx-python align table to centre of slide


I want to create a table of a specific row and column number and size and align it to the centre of the slide.

Is there any way to do this?

I found a way to align image: python pptx align image to center of slide

but cannot find anything about aligning tables.


Solution

  • You would just centre in the same way you would any other shape.

    Once created.

    shape.left = int((presentation.slide_width / 2) - (shape.width / 2))
    shape.top = int((presentation.slide_height / 2) - (shape.height / 2))