Skip to main content

Posts

Showing posts from November, 2017

How to make a presentation with powerpioint and Python

Just put this code in: from pptx import Presentation prs = Presentation() def slide(number=0):     title_slide_layout = prs.slide_layouts[number]     slide = prs.slides.add_slide(title_slide_layout)     title = slide.shapes.title     subtitle = slide.placeholders[1]     title.text = file.readline()     file.readline()     subtitle.text = file.readline()     file.readline()  # salta la riga vuota with open("imprese_produzione.txt", 'r', encoding="utf-8") as file:     file_lenght = len(file.readlines())     file.seek(0)     slide(0)     for i in range(int(file_lenght / 4)):         slide(1) prs.save('test.pptx') The txt file is something like this (respect the newlines:  Il Marketing Aspetti generali Imprese orientate alla produzione Un'impresa orientata alla produzione ritiene che...