-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
How do you add a row to an existing table that you've opened via Document('filename.docx'), for example, and match the table formatting?
I've tried things like:
last_row = table.rows[-1]
for item in data:
try:
row_cells = table.add_row()
row_cells.cells[0].text = item['label']
row_cells.cells[1].text = item['description']
row_cells.cells[0].paragraphs[0].style = 'MediumGrid1-Accent21'
# and
row_cells.cells[0].paragraphs[0].style = last_row.cells[0].paragraphs[0].style
I can add the row without problems, but I can't match the formatting of the row above.
Ideally, would love something like:
last_row = table.rows[-1]
for item in data:
try:
table.rows.push(last_row)
row_cells = table.rows[-1]
row_cells.cells[0].text = item['label']
row_cells.cells[1].text = item['description']
So, have the ability to append the prior row to the end, then change the internal text. Is that feasible?
godd9170, karpur-shukla, ClimenteA, DanielKorsa, Cewer1996 and 4 more
Metadata
Metadata
Assignees
Labels
No labels