New version
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
from pptx import Presentation
|
||||
|
||||
def generate_pptx(slides, output_file):
|
||||
prs = Presentation("template.pptx")
|
||||
|
||||
for slide_data in slides:
|
||||
slide_layout = prs.slide_layouts[1] # Title + Content
|
||||
slide = prs.slides.add_slide(slide_layout)
|
||||
|
||||
title = slide.shapes.title
|
||||
body = slide.placeholders[1].text_frame
|
||||
|
||||
title.text = slide_data.title
|
||||
body.clear()
|
||||
|
||||
for bullet in slide_data.bullets:
|
||||
p = body.add_paragraph()
|
||||
p.text = bullet
|
||||
p.level = 0
|
||||
|
||||
prs.save(output_file)
|
||||
Reference in New Issue
Block a user