diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-05-02 11:48:41 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-05-02 11:48:41 +0100 |
| commit | a0155bb9c522b9b008ad3933ffcb9609b0f698e7 (patch) | |
| tree | d3740b735a409b0a8045fad9dfdefe83b264fb0e /mammoth/docx | |
| parent | 85ff4da3812222eaa59b4be434c9118af85ced1b (diff) | |
Read colspan for table cells
Diffstat (limited to 'mammoth/docx')
| -rw-r--r-- | mammoth/docx/body_xml.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/mammoth/docx/body_xml.py b/mammoth/docx/body_xml.py index f3166f5..a44169a 100644 --- a/mammoth/docx/body_xml.py +++ b/mammoth/docx/body_xml.py @@ -164,8 +164,21 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f def table_cell(element): + gridspan = element \ + .find_child_or_null("w:tcPr") \ + .find_child_or_null("w:gridSpan") \ + .attributes.get("w:val") + + if gridspan is None: + colspan = 1 + else: + colspan = int(gridspan) + return _read_xml_elements(element.children) \ - .map(documents.table_cell) + .map(lambda children: documents.table_cell( + children=children, + colspan=colspan + )) def read_child_elements(element): |
