diff options
| -rw-r--r-- | src/Text/Pandoc/Readers/Docx.hs | 4 | ||||
| -rw-r--r-- | src/Text/Pandoc/Readers/Docx/Parse.hs | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Docx.hs b/src/Text/Pandoc/Readers/Docx.hs index 8ec14c040..da0cca1dc 100644 --- a/src/Text/Pandoc/Readers/Docx.hs +++ b/src/Text/Pandoc/Readers/Docx.hs @@ -837,7 +837,9 @@ bodyPartToBlocks (Tbl mbsty cap grid look parts) = do alignments = case rows of [] -> replicate width Pandoc.AlignDefault Docx.Row _ cs : _ -> concatMap getAlignment cs - widths = map ColWidth grid + widths = map (\n -> if n == 0 + then ColWidthDefault + else ColWidth n) grid extStylesEnabled <- asks (isEnabled Ext_styles . docxOptions) let attr = case mbsty of diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs index c2ad9e837..68069d7d6 100644 --- a/src/Text/Pandoc/Readers/Docx/Parse.hs +++ b/src/Text/Pandoc/Readers/Docx/Parse.hs @@ -875,9 +875,15 @@ elemToBodyPart ns element Just l -> elemToTblLook ns l Nothing -> return defaultTblLook - grid <- grid' + grid'' <- grid' tblLook <- tblLook' rows <- mapD (elemToRow ns) (elChildren element) + let grid = if null grid'' + then let numcols = case rowsToRowspans rows of + (cs@(_:_):_) -> sum (map fst cs) + _ -> 0 + in replicate numcols 0.0 + else grid'' return $ Tbl mbstyle (caption <> description) grid tblLook rows elemToBodyPart _ _ = throwError WrongElem |
