首页 > 解决方案 > 如何使用 python pptx 从 powerpoint 中提取特定文本?

问题描述

我正在使用 ue4 & python pptx,我正在尝试将我的文本类型分成数组。我的标题文本在他们自己的数组中,我的图像也在他们的数组中。但是,我希望将所有其他不是标题的文本放入其自己的数组中,但在尝试仅提取特定文本时会傻眼。我目前有这个提取所有文本:

for slide in prs.slides:
    titlePlaceholder = slide.shapes.title.text
    titleArray.append(titlePlaceholder)
    for shape in slide.shapes:
        if not shape.has_text_frame:
            continue
        for paragraph in shape.text_frame.paragraphs:
            for run in paragraph.runs:
                paraArray.append(run.text)

标签: pythonpython-pptx

解决方案


推荐阅读