scanny / python-pptx

Create Open XML PowerPoint documents in Python
MIT License
2.26k stars 498 forks source link

Unable to open generated presentation #941

Open TaokyleYT opened 5 months ago

TaokyleYT commented 5 months ago

I directly used the template code from pypi

from pptx import Presentation

prs = Presentation()
title_slide_layout = prs.slide_layouts[0]
slide = prs.slides.add_slide(title_slide_layout)
title = slide.shapes.title
subtitle = slide.placeholders[1]

title.text = "Hello, World!"
subtitle.text = "python-pptx was here!"

prs.save('test.pptx')

and when I open the test.pptx on both online platform, microsoft powerpoint and google slide, non of them work. online platform says this is corrupted microsoft powerpoint says this is not valid and google slide says they can't open it at the moment

is it my problem or the module's?

TaokyleYT commented 5 months ago

ok so after some tries, I found out when a textbox is present the file will instantly go corrupt somehow, is there any way to fix it?

MartinPacker commented 5 months ago

Strange. I cut and pasted the above code (which I recognise from the manual) and ran it. The file produced was perfectly acceptable to PowerPoint (on my Mac).