Skip to content
This repository has been archived by the owner on Apr 16, 2022. It is now read-only.

Nested tables add rows to outer table and not inner table #75

Open
th1234 opened this issue Nov 30, 2019 · 1 comment
Open

Nested tables add rows to outer table and not inner table #75

th1234 opened this issue Nov 30, 2019 · 1 comment

Comments

@th1234
Copy link

th1234 commented Nov 30, 2019

image

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
Copy link

Hi @th1234 I've the same problems and I newbie in python. Did you find a solution to merge nested tables?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants