DOCX Output: vertical alignment for table cells

This commit is contained in:
Kovid Goyal 2015-04-09 09:15:36 +05:30
parent e59e1060ae
commit 732e92fb3f

View File

@ -94,6 +94,7 @@ class Cell(object):
self.col_span = max(0, int(html_tag.get('colspan', 1)))
except Exception:
self.col_span = 1
self.valign = {'top':'top', 'bottom':'bottom', 'middle':'center'}.get(tag_style._get('vertical-align'))
self.items = []
self.width = convert_width(tag_style)
self.background_color = None if tag_style is None else convert_color(tag_style.backgroundColor)
@ -134,6 +135,9 @@ class Cell(object):
if len(m) > 0:
tcPr.append(m)
if self.valign is not None:
makeelement(tcPr, 'w:vAlign', w_val=self.valign)
if self.row_span > 1:
makeelement(tcPr, 'w:vMerge', w_val='restart')
if self.col_span > 1: