gpt4 book ai didi

python - 使用 pptx 读取 PowerPoint 表格中的文本值?

转载 作者:行者123 更新时间:2023-11-30 23:23:19 25 4
gpt4 key购买 nike

使用 pptx 模块,

 tbl.cell(3,3).text

是可写但不可读的属性。有没有办法只阅读 PowerPoint 表格中的文本?我试图避免使用 COM,pptx 是一个很棒的模块,但缺乏这个特殊功能。

谢谢!

最佳答案

目前,您需要更深入地使用 python-pptx 从单元格中获取文本。 cell.text“getter”已在路线图上。

这样的事情应该可以完成:

cell = tbl.cell(3, 3)
paragraphs = cell.textframe.paragraphs
for paragraph in paragraphs:
for run in paragraph.runs:
print run.text

如果您需要更多内容,请告诉我。

关于python - 使用 pptx 读取 PowerPoint 表格中的文本值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24045996/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com