Finally, I changed my method of working with my powerpoint. I use the method described in the python library :
if name == "main": # Charger le template template_path = 'path/to/template.pptx' with open(template_path, 'rb') as f: source_stream = BytesIO(f.read()) prs = Presentation(source_stream)
# Exemple de données
data = {
'nom_projet': 'Projet X',
'date': '2023-10-01',
# Ajoutez d'autres paires clé-valeur selon vos besoins
}
generate_template(prs, data)
fill_in_doc(prs, data)
# Sauvegarder la présentation
target_stream = BytesIO()
prs.save(target_stream)
with open('path/to/output.pptx', 'wb') as f:
f.write(target_stream.getvalue())