From ff8b54b819c08e97cc35dc123fdb4b64969d4ef6 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 1 Dec 2013 13:30:53 +0000 Subject: Read run style from run properties --- mammoth/docx/document_xml.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'mammoth/docx/document_xml.py') diff --git a/mammoth/docx/document_xml.py b/mammoth/docx/document_xml.py index 403f880..c3fb1b7 100644 --- a/mammoth/docx/document_xml.py +++ b/mammoth/docx/document_xml.py @@ -22,7 +22,11 @@ def _create_reader(numbering): @handler("w:r") def run(element): - return documents.run(_read_xml_elements(element.children)) + properties = element.find_child_or_null("w:rPr") + style_name = properties \ + .find_child_or_null("w:rStyle") \ + .attributes.get("w:val") + return documents.run(_read_xml_elements(element.children), style_name) @handler("w:p") -- cgit v1.2.3