【发布时间】:2017-01-20 12:44:17
【问题描述】:
我正在尝试使用 python-docx 从 MS-word 文档中检索粗体和红色的内容,但是如果表格单元格中的全部内容是粗体并且整个段落是粗体,则 run.bold 返回 None。 如何在 python-docx 中检索单元格格式详细信息。
这是我的代码:
for table in WordDoc.tables:
for i in xrange(1, len(table.rows)):
for para in table.rows[i].cells[0].paragraphs:
for run in para.runs:
if run.bold:
print (run.text)
【问题讨论】:
标签: python ms-word python-docx