From 1794d8f8d6a828f42f654fa1c0258354193d8773 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 9 Apr 2015 09:33:12 +0530 Subject: [PATCH] DOCX Output: Fix nested tables not working --- src/calibre/ebooks/docx/writer/tables.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calibre/ebooks/docx/writer/tables.py b/src/calibre/ebooks/docx/writer/tables.py index e821adc3c9..21bef908fc 100644 --- a/src/calibre/ebooks/docx/writer/tables.py +++ b/src/calibre/ebooks/docx/writer/tables.py @@ -142,8 +142,12 @@ class Cell(object): makeelement(tcPr, 'w:vMerge', w_val='restart') if self.col_span > 1: makeelement(tcPr, 'w:hMerge', w_val='restart') + for item in self.items: item.serialize(tc) + if isinstance(item, Table): + # Word 2007 requires the last element in a table cell to be a paragraph + makeelement(tc, 'w:p') def applicable_borders(self, edge): if edge == 'left':