scanny / python-pptx

Create Open XML PowerPoint documents in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to open generated presentation

TaokyleYT opened this issue · 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?

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?

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