如何解决从PPTx文件中提取演示者注释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))
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。