Merge pull request #152 from devgt/master

Fix invalid xml parse because using {%vm%}
This commit is contained in:
Eric Lapouyade 2018-10-16 15:54:51 +02:00 committed by GitHub
commit 344fe8215d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -189,7 +189,8 @@ class DocxTemplate(object):
# using of TC tag in for cycle can cause that count of columns does not correspond to
# real count of columns in row. This function is able to fix it.
def fix_tables(self, xml):
tree = etree.fromstring(xml)
parser = etree.XMLParser(recover=True)
tree = etree.fromstring(xml, parser=parser)
# get namespace
ns = '{' + tree.nsmap['w'] + '}'
# walk trough xml and find table