How to extract comments from PowerPoint presentation slides using Python(如何使用Python从PowerPoint演示文稿幻灯片中提取批注)
问题描述
我需要从一系列PowerPoint演示文稿中提取批注(使用Microsoft PowerPoint批注功能)。
以下链接说明如何在C#中执行此操作:
https://www.e-iceblue.com/Tutorials/Spire.Presentation/Spire.Presentation-Program-Guide/Comment-and-Note/Extract-comments-from-presentation-slides-and-save-in-txt-file.html
似乎python-pptx没有从PowerPoint读取/写入评论的功能:
https://python-pptx.readthedocs.io/en/latest/
如果存在这样的功能,我在上面的文档中找不到。
有什么方法可以做到这一点吗?
推荐答案
我能够做到这一点,方法是使用Win32com访问注释对象并从那里操作它,如K753所建议的:
import win32com.client
ppt_dir = 'test.pptx'
ppt_app = win32com.client.GetObject(ppt_dir)
for ppt_slide in ppt_app.Slides:
for comment in ppt_slide.Comments:
print(comment.Text)
以下文档提供了有关Comment对象的更多详细信息:
https://docs.microsoft.com/en-us/office/vba/api/powerpoint.comment
这篇关于如何使用Python从PowerPoint演示文稿幻灯片中提取批注的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用Python从PowerPoint演示文稿幻灯片中提取批注


- 沿轴计算直方图 2022-01-01
- pytorch 中的自适应池是如何工作的? 2022-07-12
- 如何将一个类的函数分成多个文件? 2022-01-01
- 分析异常:路径不存在:dbfs:/databricks/python/lib/python3.7/site-packages/sampleFolder/data; 2022-01-01
- padding='same' 转换为 PyTorch padding=# 2022-01-01
- python check_output 失败,退出状态为 1,但 Popen 适用于相同的命令 2022-01-01
- 如何在 python3 中将 OrderedDict 转换为常规字典 2022-01-01
- 使用Heroku上托管的Selenium登录Instagram时,找不到元素';用户名'; 2022-01-01
- python-m http.server 443--使用SSL? 2022-01-01
- 如何在 Python 的元组列表中对每个元组中的第一个值求和? 2022-01-01