from docx import Document
from pptx import Presentation
wordfile=Document()
filepath=r'test.pptx'
pptx=Presentation(filepath)
for slide in pptx.slides:
for shape in slide.shapes:
if shape.has_text_frame:
text_frame=shape.text_frame
for paragraph in text_frame.paragraphs:
wordfile.add_paragraph(paragraph.text)
save_path=r'test.docx'
wordfile.save(save_path)
python之从PPT提取文字到word
2023-12-25 14:26:02 59 阅读