I’m having an issue with Table Row borders. All seems to be working great up to rows 250-260 in all tables. Although my script indicates the task is getting done, the output shows no borders after said rows. Is there a strange upper limit or something? Data will write to the table as it should, cell merging will happen as it should, just the borders will stop being drawn.
Running python-docx v1.1.2 in python 3.9.2.
Just so it’s here, here is my function that I’m calling, which again is function all the way up to these rows:
def set_whole_row_border(table, part_row):
tbl = table._tbl
rows = tbl.getchildren()
for this_row in rows:
if isinstance(this_row, CT_Row):
cells = this_row.getchildren()
if this_row.tr_idx is part_row:
for cell in cells:
tcPr = cell.tcPr
tcBorders = OxmlElement('w:tcBorders')
top = OxmlElement('w:top')
top.set(qn('w:val'), 'single')
top.set(qn('w:sz'), '12')
top.set(qn('w:space'), '0')
top.set(qn('w:color'), '#000000')
tcBorders.append(top)
bottom = OxmlElement('w:bottom')
bottom.set(qn('w:val'), 'single')
bottom.set(qn('w:sz'), '4')
bottom.set(qn('w:space'), '0')
bottom.set(qn('w:color'), '#000000')
tcBorders.append(bottom)
tcPr.append(tcBorders)
print('border done for row', part_row)
jChandy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2