Nested tables add rows to outer table and not inner table
th1234 opened this issue · 1 comments
th1234 commented
Possible Solution
When finding the anchor, sort the tables by the number of tables in ascending order. This way the most inner table will be checked first.
example code change is to change
"for table in part.findall('.//{%(w)s}tbl' % NAMESPACES):"
to
"for table in sorted(part.findall('.//{%(w)s}tbl' % NAMESPACES), key=len):"
Environment
- Python version: 3.6.9
- docx-mailmerge version: 0.5.0
c-perez-fajardo commented
Hi @th1234 I've the same problems and I newbie in python. Did you find a solution to merge nested tables?