summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2018-01-03 10:55:23 -0500
committerJesse Rosenthal <jrosenthal@jhu.edu>2018-01-03 11:56:41 -0500
commitcd00225219f2d71d74a61d99df4906dfb92e3797 (patch)
tree1d14392e24255d190a269b43393adda24a581831
parent2f5cca85fa1842a3265aed949502f5811ead51a6 (diff)
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.
-rw-r--r--src/Text/Pandoc/Writers/Powerpoint.hs16
1 files changed, 10 insertions, 6 deletions
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" [] ()