From a0155bb9c522b9b008ad3933ffcb9609b0f698e7 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Mon, 2 May 2016 11:48:41 +0100 Subject: Read colspan for table cells --- tests/docx/body_xml_tests.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests') diff --git a/tests/docx/body_xml_tests.py b/tests/docx/body_xml_tests.py index 7ed325c..8fb35cf 100644 --- a/tests/docx/body_xml_tests.py +++ b/tests/docx/body_xml_tests.py @@ -221,6 +221,29 @@ class ReadXmlElementTests(object): ]) ]) assert_equal(expected_result, table) + + + @istest + def gridspan_is_read_as_colspan_for_table_cell(self): + element = xml_element("w:tbl", {}, [ + xml_element("w:tr", {}, [ + xml_element("w:tc", {}, [ + xml_element("w:tcPr", {}, [ + xml_element("w:gridSpan", {"w:val": "2"}) + ]), + xml_element("w:p", {}, []) + ]), + ]), + ]) + table = _read_and_get_document_xml_element(element) + expected_result = documents.table([ + documents.table_row([ + documents.table_cell([ + documents.paragraph([]) + ], colspan=2) + ]) + ]) + assert_equal(expected_result, table) @istest -- cgit v1.2.3