This commit is contained in:
Kovid Goyal 2015-05-14 18:31:24 +05:30
parent 0fdf12e446
commit 25b918a931
2 changed files with 7 additions and 4 deletions

View File

@ -405,8 +405,11 @@ class BlockStyle(DOCXStyle):
except (TypeError, ValueError):
self.line_height = max(0, int(1.2 * css.fontSize * 20))
self.background_color = None if is_table_cell else convert_color(css['background-color'])
self.text_align = {'start':'left', 'left':'left', 'end':'right', 'right':'right', 'center':'center', 'justify':'both', 'centre':'center'}.get(
css['text-align'].lower(), 'left')
try:
self.text_align = {'start':'left', 'left':'left', 'end':'right', 'right':'right', 'center':'center', 'justify':'both', 'centre':'center'}.get(
css['text-align'].lower(), 'left')
except AttributeError:
self.text_align = 'left'
DOCXStyle.__init__(self, namespace)

View File

@ -301,8 +301,8 @@ class Table(object):
except Exception:
tcell = None
if tcell is None:
nrow.extend([SpannedCell(nrow[-1], horizontal=True) for i in xrange(idx - len(nrow))])
nrow.append(sc)
nrow.cells.extend([SpannedCell(nrow.cells[-1], horizontal=True) for i in xrange(idx - len(nrow.cells))])
nrow.cells.append(sc)
else:
if isinstance(tcell, SpannedCell):
# Conflict between rowspan and colspan