From 838736f4d74b43d59aa7bdc96830e0be7fd7f258 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 20 May 2017 15:28:37 +0100 Subject: Read whether row is header --- mammoth/docx/body_xml.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'mammoth/docx') diff --git a/mammoth/docx/body_xml.py b/mammoth/docx/body_xml.py index cc4e98f..49ff431 100644 --- a/mammoth/docx/body_xml.py +++ b/mammoth/docx/body_xml.py @@ -62,6 +62,7 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f "w:rPr", "w:tblPr", "w:tblGrid", + "w:trPr", "w:tcPr", ]) @@ -208,8 +209,13 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f def table_row(element): + properties = element.find_child_or_null("w:trPr") + is_header = bool(properties.find_child("w:tblHeader")) return _read_xml_elements(element.children) \ - .map(documents.table_row) + .map(lambda children: documents.table_row( + children=children, + is_header=is_header, + )) def table_cell(element): -- cgit v1.2.3