git.iko.soy/typeable/pandoc
on master help sign in
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.

commitcd00225219f2d71d74a61d99df4906dfb92e3797 authorJesse Rosenthal <jrosenthal@jhu.edu> dateWed 3 Jan 2018, 10:55 (9 years ago) parent2f5cca8
1 file changed+10−6
src/Text/Pandoc/Writers/Powerpoint.hs+10−6
src/Text/Pandoc/Writers/Powerpoint.hs+10−6
@@ -1313,12 +1313,16 @@ hardcodedTableMargin = 36
13131313
13141314graphicToElement :: PandocMonad m => Graphic -> P m Element
13151315graphicToElement (Tbl tblPr colWidths hdrCells rows) = do
1316− let cellToOpenXML paras = do elements <- mapM paragraphToElement paras
1317− return $
1318− [mknode "a:txBody" [] $
1319− ([ mknode "a:bodyPr" [] ()
1320− , mknode "a:lstStyle" [] ()]
1321− ++ elements)]
1316+ let cellToOpenXML paras =
1317+ do elements <- mapM paragraphToElement paras
1318+ let elements' = if null elements
1319+ then [mknode "a:p" [] [mknode "a:endParaRPr" [] ()]]
1320+ else elements
1321+ return $
1322+ [mknode "a:txBody" [] $
1323+ ([ mknode "a:bodyPr" [] ()
1324+ , mknode "a:lstStyle" [] ()]
1325+ ++ elements')]
13221326 headers' <- mapM cellToOpenXML hdrCells
13231327 rows' <- mapM (mapM cellToOpenXML) rows
13241328 let borderProps = mknode "a:tcPr" [] ()