diff --git a/pydocx/export/html.py b/pydocx/export/html.py index 18e3ea53..d6744c36 100644 --- a/pydocx/export/html.py +++ b/pydocx/export/html.py @@ -668,6 +668,9 @@ def export_table_cell(self, table_cell): attrs['colspan'] = colspan if rowspan > 1: attrs['rowspan'] = rowspan + fill = getattr(table_cell.properties, 'shading', None) + if fill and fill != 'auto': + attrs['style'] = 'background-color:#%s;' % fill tag = HtmlTag('td', **attrs) numbering_spans = self.yield_numbering_spans(table_cell.children) diff --git a/pydocx/openxml/wordprocessing/table_cell_properties.py b/pydocx/openxml/wordprocessing/table_cell_properties.py index 2a94c9b0..ce40db3e 100644 --- a/pydocx/openxml/wordprocessing/table_cell_properties.py +++ b/pydocx/openxml/wordprocessing/table_cell_properties.py @@ -14,6 +14,7 @@ class TableCellProperties(XmlModel): grid_span = XmlChild(name='gridSpan', attrname='val') vertical_merge = XmlChild(name='vMerge', type=lambda el: dict(el.attrib)) # noqa + shading = XmlChild(name='shd', attrname='fill') def should_close_previous_vertical_merge(self): # If vMerge is omitted, then this cell shall not be part of any