-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
HI there, I would like to check if it is possible to print nested tables out using this library? I tried to work on it but however, it just prints the nested table as empty.
from docx import Document
f = open('a.docx', 'rb')
doc = Document(f)
table = doc.tables[0]
data = []
keys = None
for i, row in enumerate(table.columns):
text = (cell.text for cell in row.cells)
if i == 0:
keys = tuple(text)
continue
row_data = dict(zip(keys, text))
data.append(row_data)
print (data)
x = 0
for i in doc.paragraphs:
if x < 20:
print (i.text)
else:
break
x = x + 1
f.close()
Metadata
Metadata
Assignees
Labels
No labels