aboutsummaryrefslogtreecommitdiff
path: root/mammoth/docx/body_xml.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2017-11-03 16:30:11 +0000
committerMichael Williamson <mike@zwobble.org>2017-11-03 16:30:11 +0000
commit1498397f4ede71d81ec79f380d43ec041438a047 (patch)
tree8b9751ed744ca75cf6aa140fe227c94431129e1e /mammoth/docx/body_xml.py
parentcd95535a1bb0f486d4a102cfc622ae5228c3071d (diff)
Read table style applied to tables
Diffstat (limited to 'mammoth/docx/body_xml.py')
-rw-r--r--mammoth/docx/body_xml.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/mammoth/docx/body_xml.py b/mammoth/docx/body_xml.py
index 6577522..01920f0 100644
--- a/mammoth/docx/body_xml.py
+++ b/mammoth/docx/body_xml.py
@@ -213,9 +213,22 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f
def table(element):
- return _read_xml_elements(element.children) \
- .flat_map(calculate_row_spans) \
- .map(documents.table)
+ properties = element.find_child_or_null("w:tblPr")
+ return _ReadResult.map_results(
+ read_table_style(properties),
+ _read_xml_elements(element.children)
+ .flat_map(calculate_row_spans),
+
+ lambda style, children: documents.table(
+ children=children,
+ style_id=style[0],
+ style_name=style[1],
+ ),
+ )
+
+
+ def read_table_style(properties):
+ return _read_style(properties, "w:tblStyle", "Table", styles.find_table_style_by_id)
def table_row(element):