从 PPTx 文件 (powerpoint) 中提取演示者注释

Extract presenter notes from PPTx file (powerpoint)

python 或 php 中是否有解决方案可以让我从 powerpoint 文件中的每张幻灯片中获取演示者注释?

谢谢

您可以使用 python-pptx.

pip install python-pptx

您可以执行以下操作来提取演讲者备注:

from pptx import Presentation

file = 'path/to/presentation.pptx'

ppt=Presentation(file)

notes = []

for page, slide in enumerate(ppt.slides):
    # this is the notes that doesn't appear on the ppt slide,
    # but really the 'presenter' note. 
    textNote = slide.notes_slide.notes_text_frame.text
    notes.append((page,textNote)) 

print(notes)

notes 列表将包含不同页面上的所有注释。

如果你想提取幻灯片上的文字内容,你需要这样做:

for page, slide in enumerate(ppt.slides):
    temp = []
    for shape in slide.shapes:
        # this will extract all text in text boxes on the slide.
        if shape.has_text_frame and shape.text.strip():
            temp.append(shape.text)
    notes.append((page,temp))