Erstellen Sie neue PPTX mit vorhandenem PPTX

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Erstellen Sie neue PPTX mit vorhandenem PPTX

by Anonymous » 18 Aug 2025, 08:56

Ich versuche, New.pptx mit old.pptx zu erstellen. Old.pptx hat 4 Folien. Ich möchte new.pptx mit fast dem gleichen Inhalt mit wenigen Textänderungen in 4 Folien erstellen. Ich habe den Modifikationsteil aus dem folgenden Code übersprungen. Ich muss diese Dinge in der Laufzeit tun, damit wenn ich nur old.PPTX bestehe, wird sie die erforderliche Operation ausführen und sie dann an New.PPTX mit der gleichen Anzahl von Folien schreiben. Ich bin mir nicht sicher, wie ich unten optimieren soll, vielleicht muss ich es vollständig ändern. < /P>

Code: Select all

from pptx import Presentation

prs1 = Presentation()

prs = Presentation('old.pptx')

title_slide_layout = prs1.slide_layouts[0]
for slide in prs.slides:
for shape in slide.shapes:
if not shape.has_text_frame:
continue
for paragraph in shape.text_frame.paragraphs:
#print(paragraph.text)
prs1.slides.add_slide(paragraph.text)
prs1.save('new.pptx')

Top