python-pptx
python-pptx copied to clipboard
Cannot open the pptx neither in Keynotes and Powerpoint.
Hello, I'm just trying to get an example of a pptx to start adding things. But I cannot even open the pptx I got from my code.
This is the code, so simple. As I don't receive any extra info or errors don't know what is going bad.
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')
response = HttpResponse(prs, headers={
'Content-Type': 'application/vnd.ms-powerpoint',
'Content-Disposition': 'attachment; filename="test.pptx"',
})
return response
Thank you so much.
What are your import statements?
Sorry for the delay, my imports are (have some Django imports on views file):
from pptx import Presentation
from ...views import viewsets, APIView, IsAuthenticated, action,\
HttpResponse
I'm not getting any error 😅