python之从PPT提取文字到word

2023-12-24 23:30:17

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)

文章来源:https://blog.csdn.net/T20151470/article/details/135188573
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。