0
点赞
收藏
分享

微信扫一扫

IntelliJ IDEA 2023.3.2

zidea 2023-12-28 阅读 49

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)

举报

相关推荐

0 条评论