Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d1d2b3f

Browse files
authored
Update write_docx.py
1 parent a6529af commit d1d2b3f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

write-to-word/write_docx.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
'first item in ordered list', style='List Number'
2323
)
2424

25-
document.add_picture('C:\\Users\\soumi\\Pictures\\application.jpg', width=Inches(1.25))
25+
document.add_picture('write-word-using-python.jpg', width=Inches(1.25))
2626

2727

2828
recordset = [
@@ -42,7 +42,7 @@
4242
"desc": "New item"
4343
}
4444
]
45-
print(recordset[0]['id'])
45+
#print(recordset[0]['id'])
4646
table = document.add_table(rows=1, cols=3)
4747
hdr_cells = table.rows[0].cells
4848
hdr_cells[0].text = 'Id'
@@ -51,10 +51,10 @@
5151
for item in recordset:
5252
#print(item)
5353
row_cells = table.add_row().cells
54-
row_cells[0].text = item['id']
55-
row_cells[1].text = item['qty']
56-
row_cells[2].text = item['desc']
54+
row_cells[0].text = str(item['id'])
55+
row_cells[1].text = str(item['qty'])
56+
row_cells[2].text = str(item['desc'])
5757

5858
document.add_page_break()
5959

60-
document.save('simple.docx')
60+
document.save('simple.docx')

0 commit comments

Comments
 (0)