aboutsummaryrefslogtreecommitdiff
path: root/mammoth/docx/document_xml.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2014-06-08 22:30:06 +0100
committerMichael Williamson <mike@zwobble.org>2014-06-08 22:30:06 +0100
commitb89d6302c0a0f03d7c33082fa4a4a7a277925f8a (patch)
tree048ec4607ee343351ea632aa097d9d65d9ad6719 /mammoth/docx/document_xml.py
parentf37fce68a77630a199737959e9d235d0a1263662 (diff)
Read run style name from docx document
Diffstat (limited to 'mammoth/docx/document_xml.py')
-rw-r--r--mammoth/docx/document_xml.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/mammoth/docx/document_xml.py b/mammoth/docx/document_xml.py
index 83d82df..247bcbc 100644
--- a/mammoth/docx/document_xml.py
+++ b/mammoth/docx/document_xml.py
@@ -51,6 +51,12 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file):
style_id = properties \
.find_child_or_null("w:rStyle") \
.attributes.get("w:val")
+
+ if style_id is None:
+ style_name = None
+ else:
+ style_name = styles.find_character_style_by_id(style_id).name
+
is_bold = properties.find_child("w:b")
is_italic = properties.find_child("w:i")
@@ -58,6 +64,7 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file):
.map(lambda children: documents.run(
children=children,
style_id=style_id,
+ style_name=style_name,
is_bold=is_bold,
is_italic=is_italic,
))