diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2023-07-01 13:04:12 -0700 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2023-07-01 13:04:12 -0700 |
| commit | e634d8b87d9fb877658583b03418c23748b70dc5 (patch) | |
| tree | 611b5e0e1889d5700154f2ee3bdef6ea0f262c5a | |
| parent | 6e9eed8fdde7693ac609d05f015f1b05e410de88 (diff) | |
Docx writer: make relative widths work in tables.
This didn't work before because we were missing an attribute that
tells Word to used fixed widths rather than computing optimal ones.
| -rw-r--r-- | src/Text/Pandoc/Writers/Docx/Table.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Docx/Table.hs b/src/Text/Pandoc/Writers/Docx/Table.hs index c8d3fc104..70a2f66ed 100644 --- a/src/Text/Pandoc/Writers/Docx/Table.hs +++ b/src/Text/Pandoc/Writers/Docx/Table.hs @@ -32,7 +32,7 @@ import Text.Pandoc.Definition Alignment(..), RowSpan(..), ColSpan(..), - ColWidth(ColWidth) ) + ColWidth(..) ) import Text.Pandoc.Class.PandocMonad (PandocMonad) import Text.Pandoc.Translations (translateTerm) import Text.Pandoc.Writers.Docx.Types @@ -109,6 +109,7 @@ tableToOpenXML opts blocksToOpenXML gridTable = do let (gridCols, tblWattr) = tableLayout (elems colspecs) listLevel <- asks envListLevel let indent = (listLevel + 1) * 720 + let hasWidths = not $ all ((== ColWidthDefault) . snd) colspecs let tbl = mknode "w:tbl" [] ( mknode "w:tblPr" [] ( mknode "w:tblStyle" [("w:val","Table")] () : @@ -124,6 +125,7 @@ tableToOpenXML opts blocksToOpenXML gridTable = do mknode "w:jc" [("w:val","start")] () : [ mknode "w:tblInd" [("w:w", tshow indent),("w:type","dxa")] () | indent > 0 ] ++ + [ mknode "w:tblLayout" [("w:type", "fixed")] () | hasWidths ] ++ [ mknode "w:tblCaption" [("w:val", captionStr)] () | not (T.null captionStr) ] ) |
