From cd00225219f2d71d74a61d99df4906dfb92e3797 Mon Sep 17 00:00:00 2001
From: Jesse Rosenthal <jrosenthal@jhu.edu>
Date: Wed, 3 Jan 2018 10:55:23 -0500
Subject: PowerPoint writer: Fix error with empty table cell.

We require an empty "<a:p>" tag, even if the cell contains no
paragraphs -- otherwise PowerPoint complains of corruption.
---
 src/Text/Pandoc/Writers/Powerpoint.hs | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

(limited to 'src')

diff --git a/src/Text/Pandoc/Writers/Powerpoint.hs b/src/Text/Pandoc/Writers/Powerpoint.hs
index 12967a196..d21e6b494 100644
--- a/src/Text/Pandoc/Writers/Powerpoint.hs
+++ b/src/Text/Pandoc/Writers/Powerpoint.hs
@@ -1313,12 +1313,16 @@ hardcodedTableMargin = 36
 
 graphicToElement :: PandocMonad m => Graphic -> P m Element
 graphicToElement (Tbl tblPr colWidths hdrCells rows) = do
-  let cellToOpenXML paras = do elements <- mapM paragraphToElement paras
-                               return $
-                                 [mknode "a:txBody" [] $
-                                  ([ mknode "a:bodyPr" [] ()
-                                   , mknode "a:lstStyle" [] ()]
-                                   ++ elements)]
+  let cellToOpenXML paras =
+        do elements <- mapM paragraphToElement paras
+           let elements' = if null elements
+                           then [mknode "a:p" [] [mknode "a:endParaRPr" [] ()]]
+                           else elements
+           return $
+             [mknode "a:txBody" [] $
+               ([ mknode "a:bodyPr" [] ()
+                , mknode "a:lstStyle" [] ()]
+                 ++ elements')]
   headers' <- mapM cellToOpenXML hdrCells
   rows' <- mapM (mapM cellToOpenXML) rows
   let borderProps = mknode "a:tcPr" [] ()
-- 
cgit v1.2.3