Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pydocx/export/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions pydocx/openxml/wordprocessing/table_cell_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down