scanny / python-pptx

Create Open XML PowerPoint documents in Python
MIT License
2.28k stars 502 forks source link

Layout & elements issue when configuring to 16:09 #873

Closed luischitala closed 1 year ago

luischitala commented 1 year ago

Hello!

Thank you for this great package!

I was configuring some presentations to be in format 16:9 but when applying this configuration the layout is not centered, see the example in the image below. I'm using the last version.

My code is shown below.

` X = Presentation() X.slide_width = Inches(16) X.slide_height = Inches(9)

    Layout = X.slide_layouts[0]
    layout_1 = X.slide_layouts[1]
    first_slide = X.slides.add_slide(Layout)
    second_slide = X.slides.add_slide(layout_1)

    title = first_slide.shapes.title
    title.text = "Example"

    title.vertical_anchor = MSO_ANCHOR.MIDDLE
    subtitle = first_slide.placeholders[1]
    subtitle.text = "Placeholders"`

Any suggests or considerations that I might no be considering ?

Thank you in advance!

image

luischitala commented 1 year ago

I found a temporal solution hehe as per: https://stackoverflow.com/questions/58414238/how-can-i-set-the-size-of-a-slide-using-pptx-python

It's better to start with a manually created 16:9 presentation and then open it to modify it.

It worked as I wanted to distribute the elements. Actually it was written by Scanny, thank you! image