我能找到的只有about paragraphs as wholes(似乎是这样)。仍尝试使用解决方案,但出现错误(“AttributeError:.runs”)。你知道吗
我查看了python-docx documentation,但我不知道如何在这里应用这些信息。你知道吗
我的段落有斜体字,可能还有部分字。我想我需要的是一个检查字符是否斜体的循环。你知道吗
import win32com.client as win32
word = win32.Dispatch("Word.Application")
word.Visible = 0
word.Documents.Open("C:**path**.docx")
doc = word.ActiveDocument
doc.Tables.Count
table = doc.Tables(1)
index = list(range(0, 1000))
for i in index:
s = table.Cell(Row =i, Column =1).Range.Text
# now another loop, using 'run' object?
我对
docx
不熟悉,但可能您有版本问题。你知道吗您在问题中链接的文档是针对python docx 0.8.5的。你知道吗
在pypi上有一个docx模块,它似乎已经过时了,因为最高的可用版本是0.2.4。你知道吗
还有另一个名为python-docx的模块,它看起来更新(版本高达0.8.5)。你知道吗
如果使用pip安装docx,则可以更新到python docx,这将为您提供最新版本:
相关问题 更多 >
编程相关推荐