aboutsummaryrefslogtreecommitdiff
path: root/mammoth
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2014-07-06 17:37:10 +0100
committerMichael Williamson <mike@zwobble.org>2014-07-06 17:37:10 +0100
commitf1fde50666d283ff34acf00faaa2ff194915e899 (patch)
tree83904dfbd9dc80d6ba8f51661555d231afe81f87 /mammoth
parent4f5020499cd5212e214698e14d014c9289b7c72c (diff)
Read tables from docx files
Diffstat (limited to 'mammoth')
-rw-r--r--mammoth/docx/document_xml.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/mammoth/docx/document_xml.py b/mammoth/docx/document_xml.py
index 247bcbc..125b35e 100644
--- a/mammoth/docx/document_xml.py
+++ b/mammoth/docx/document_xml.py
@@ -119,6 +119,24 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file):
return results.success(documents.tab())
+ @handler("w:tbl")
+ def table(element):
+ return _read_xml_elements(element.children) \
+ .map(documents.table)
+
+
+ @handler("w:tr")
+ def table(element):
+ return _read_xml_elements(element.children) \
+ .map(documents.table_row)
+
+
+ @handler("w:tc")
+ def table(element):
+ return _read_xml_elements(element.children) \
+ .map(documents.table_cell)
+
+
@handler("w:ins")
@handler("w:smartTag")
@handler("w:drawing")