python-pptx icon indicating copy to clipboard operation
python-pptx copied to clipboard

Unable to open generated presentation

Open TaokyleYT opened this issue 1 year ago • 2 comments

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 avatar Jan 26 '24 04:01 TaokyleYT

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?

TaokyleYT avatar Jan 26 '24 12:01 TaokyleYT

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).

MartinPacker avatar Jan 26 '24 20:01 MartinPacker