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.
This commit is contained in:
Jesse Rosenthal 2018-01-03 10:55:23 -05:00
parent 2f5cca85fa
commit cd00225219

View file

@ -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" [] ()