aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/docx/word/styles.xml15
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs37
-rw-r--r--test/docx/golden/block_quotes.docxbin10001 -> 10092 bytes
-rw-r--r--test/docx/golden/codeblock.docxbin9853 -> 9944 bytes
-rw-r--r--test/docx/golden/comments.docxbin10188 -> 10279 bytes
-rw-r--r--test/docx/golden/custom_style_no_reference.docxbin9952 -> 10042 bytes
-rw-r--r--test/docx/golden/custom_style_preserve.docxbin10578 -> 10666 bytes
-rw-r--r--test/docx/golden/definition_list.docxbin9850 -> 9941 bytes
-rw-r--r--test/docx/golden/document-properties-short-desc.docxbin9856 -> 9947 bytes
-rw-r--r--test/docx/golden/document-properties.docxbin10332 -> 10423 bytes
-rw-r--r--test/docx/golden/headers.docxbin9989 -> 10080 bytes
-rw-r--r--test/docx/golden/image.docxbin26667 -> 26758 bytes
-rw-r--r--test/docx/golden/inline_code.docxbin9789 -> 9880 bytes
-rw-r--r--test/docx/golden/inline_formatting.docxbin9969 -> 10060 bytes
-rw-r--r--test/docx/golden/inline_images.docxbin26725 -> 26816 bytes
-rw-r--r--test/docx/golden/link_in_notes.docxbin10010 -> 10101 bytes
-rw-r--r--test/docx/golden/links.docxbin10185 -> 10276 bytes
-rw-r--r--test/docx/golden/lists.docxbin10261 -> 10352 bytes
-rw-r--r--test/docx/golden/lists_continuing.docxbin10052 -> 10143 bytes
-rw-r--r--test/docx/golden/lists_multiple_initial.docxbin10141 -> 10232 bytes
-rw-r--r--test/docx/golden/lists_restarting.docxbin10053 -> 10144 bytes
-rw-r--r--test/docx/golden/nested_anchors_in_header.docxbin10148 -> 10239 bytes
-rw-r--r--test/docx/golden/notes.docxbin9955 -> 10046 bytes
-rw-r--r--test/docx/golden/raw-blocks.docxbin9888 -> 9980 bytes
-rw-r--r--test/docx/golden/raw-bookmarks.docxbin10023 -> 10115 bytes
-rw-r--r--test/docx/golden/table_one_row.docxbin9834 -> 9932 bytes
-rw-r--r--test/docx/golden/table_with_list_cell.docxbin10199 -> 10249 bytes
-rw-r--r--test/docx/golden/tables.docxbin10225 -> 10266 bytes
-rw-r--r--test/docx/golden/track_changes_deletion.docxbin9833 -> 9924 bytes
-rw-r--r--test/docx/golden/track_changes_insertion.docxbin9816 -> 9907 bytes
-rw-r--r--test/docx/golden/track_changes_move.docxbin9850 -> 9941 bytes
-rw-r--r--test/docx/golden/track_changes_scrubbed_metadata.docxbin9962 -> 10053 bytes
-rw-r--r--test/docx/golden/unicode.docxbin9774 -> 9865 bytes
-rw-r--r--test/docx/golden/verbatim_subsuper.docxbin9822 -> 9913 bytes
34 files changed, 35 insertions, 17 deletions
diff --git a/data/docx/word/styles.xml b/data/docx/word/styles.xml
index 6bb5a3f52..832b1b25b 100644
--- a/data/docx/word/styles.xml
+++ b/data/docx/word/styles.xml
@@ -350,6 +350,21 @@
<w:right w:w="108" w:type="dxa" />
</w:tblCellMar>
</w:tblPr>
+ <w:tblStylePr w:type="firstRow">
+ <w:tblPr>
+ <w:jc w:val="left"/>
+ <w:tblInd w:w="0" w:type="dxa"/>
+ </w:tblPr>
+ <w:trPr>
+ <w:jc w:val="left"/>
+ </w:trPr>
+ <w:tcPr>
+ <w:vAlign w:val="bottom"/>
+ <w:tcBorders>
+ <w:bottom w:val="single"/>
+ </w:tcBorders>
+ </w:tcPr>
+ </w:tblStylePr>
</w:style>
<w:style w:type="paragraph" w:customStyle="1" w:styleId="DefinitionTerm">
<w:name w:val="Definition Term" />
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index a99e13a85..8f498775d 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -1023,23 +1023,15 @@ blockToOpenXML' opts (Table _ blkCapt specs thead tbody tfoot) = do
_ -> es ++ [Elem $ mknode "w:p" [] ()]
headers' <- mapM cellToOpenXML $ zip aligns headers
rows' <- mapM (mapM cellToOpenXML . zip aligns) rows
- let borderProps = Elem $ mknode "w:tcPr" []
- [ mknode "w:tcBorders" []
- $ mknode "w:bottom" [("w:val","single")] ()
- , mknode "w:vAlign" [("w:val","bottom")] () ]
compactStyle <- pStyleM "Compact"
let emptyCell' = [Elem $ mknode "w:p" [] [mknode "w:pPr" [] [compactStyle]]]
- let mkcell border contents = mknode "w:tc" []
- $ [ borderProps | border ] ++
- if null contents
- then emptyCell'
- else contents
- let mkrow border cells =
+ let mkcell contents = mknode "w:tc" []
+ $ if null contents
+ then emptyCell'
+ else contents
+ let mkrow cells =
mknode "w:tr" [] $
- [ mknode "w:trPr" []
- [ mknode "w:cnfStyle" [("w:firstRow","1")] ()]
- | border]
- ++ map (mkcell border) cells
+ map mkcell cells
let textwidth = 7920 -- 5.5 in in twips, 1/20 pt
let fullrow = 5000 -- 100% specified in pct
let rowwidth = fullrow * sum widths
@@ -1047,6 +1039,15 @@ blockToOpenXML' opts (Table _ blkCapt specs thead tbody tfoot) = do
[("w:w", show (floor (textwidth * w) :: Integer))] ()
let hasHeader = not $ all null headers
modify $ \s -> s { stInTable = False }
+ -- for compatibility with Word <= 2007, we include a val with a bitmask
+ -- 0×0020 Apply first row conditional formatting
+ -- 0×0040 Apply last row conditional formatting
+ -- 0×0080 Apply first column conditional formatting
+ -- 0×0100 Apply last column conditional formatting
+ -- 0×0200 Do not apply row banding conditional formatting
+ -- 0×0400 Do not apply column banding conditional formattin
+ let tblLookVal :: Int
+ tblLookVal = if hasHeader then 0x20 else 0
return $
caption' ++
[Elem $
@@ -1059,15 +1060,17 @@ blockToOpenXML' opts (Table _ blkCapt specs thead tbody tfoot) = do
,("w:firstColumn","0")
,("w:lastColumn","0")
,("w:noHBand","0")
- ,("w:noVBand","0")] () :
+ ,("w:noVBand","0")
+ ,("w:val", printf "%04x" tblLookVal)
+ ] () :
[ mknode "w:tblCaption" [("w:val", T.unpack captionStr)] ()
| not (null caption) ] )
: mknode "w:tblGrid" []
(if all (==0) widths
then []
else map mkgridcol widths)
- : [ mkrow True headers' | hasHeader ] ++
- map (mkrow False) rows'
+ : [ mkrow headers' | hasHeader ] ++
+ map mkrow rows'
)]
blockToOpenXML' opts el
| BulletList lst <- el = addOpenXMLList BulletMarker lst
diff --git a/test/docx/golden/block_quotes.docx b/test/docx/golden/block_quotes.docx
index bbc8d8de9..3e1bf16e7 100644
--- a/test/docx/golden/block_quotes.docx
+++ b/test/docx/golden/block_quotes.docx
Binary files differ
diff --git a/test/docx/golden/codeblock.docx b/test/docx/golden/codeblock.docx
index e20efcab4..66f055063 100644
--- a/test/docx/golden/codeblock.docx
+++ b/test/docx/golden/codeblock.docx
Binary files differ
diff --git a/test/docx/golden/comments.docx b/test/docx/golden/comments.docx
index f1185da98..fb3a02a0a 100644
--- a/test/docx/golden/comments.docx
+++ b/test/docx/golden/comments.docx
Binary files differ
diff --git a/test/docx/golden/custom_style_no_reference.docx b/test/docx/golden/custom_style_no_reference.docx
index 83243ab8c..bc6c2702a 100644
--- a/test/docx/golden/custom_style_no_reference.docx
+++ b/test/docx/golden/custom_style_no_reference.docx
Binary files differ
diff --git a/test/docx/golden/custom_style_preserve.docx b/test/docx/golden/custom_style_preserve.docx
index 17804bb81..8c555a5bd 100644
--- a/test/docx/golden/custom_style_preserve.docx
+++ b/test/docx/golden/custom_style_preserve.docx
Binary files differ
diff --git a/test/docx/golden/definition_list.docx b/test/docx/golden/definition_list.docx
index 21629e208..c21b3a5b3 100644
--- a/test/docx/golden/definition_list.docx
+++ b/test/docx/golden/definition_list.docx
Binary files differ
diff --git a/test/docx/golden/document-properties-short-desc.docx b/test/docx/golden/document-properties-short-desc.docx
index 5cf8db0b0..92ce144e9 100644
--- a/test/docx/golden/document-properties-short-desc.docx
+++ b/test/docx/golden/document-properties-short-desc.docx
Binary files differ
diff --git a/test/docx/golden/document-properties.docx b/test/docx/golden/document-properties.docx
index 14bfab6d4..d21b67309 100644
--- a/test/docx/golden/document-properties.docx
+++ b/test/docx/golden/document-properties.docx
Binary files differ
diff --git a/test/docx/golden/headers.docx b/test/docx/golden/headers.docx
index 416743aa1..3558a47bf 100644
--- a/test/docx/golden/headers.docx
+++ b/test/docx/golden/headers.docx
Binary files differ
diff --git a/test/docx/golden/image.docx b/test/docx/golden/image.docx
index ef2940f89..606df92a3 100644
--- a/test/docx/golden/image.docx
+++ b/test/docx/golden/image.docx
Binary files differ
diff --git a/test/docx/golden/inline_code.docx b/test/docx/golden/inline_code.docx
index 479ea65ec..759269cac 100644
--- a/test/docx/golden/inline_code.docx
+++ b/test/docx/golden/inline_code.docx
Binary files differ
diff --git a/test/docx/golden/inline_formatting.docx b/test/docx/golden/inline_formatting.docx
index e12e3b38d..c37777080 100644
--- a/test/docx/golden/inline_formatting.docx
+++ b/test/docx/golden/inline_formatting.docx
Binary files differ
diff --git a/test/docx/golden/inline_images.docx b/test/docx/golden/inline_images.docx
index 8bd57bb8c..9450b1a73 100644
--- a/test/docx/golden/inline_images.docx
+++ b/test/docx/golden/inline_images.docx
Binary files differ
diff --git a/test/docx/golden/link_in_notes.docx b/test/docx/golden/link_in_notes.docx
index 2c6a638fc..6f0b830e6 100644
--- a/test/docx/golden/link_in_notes.docx
+++ b/test/docx/golden/link_in_notes.docx
Binary files differ
diff --git a/test/docx/golden/links.docx b/test/docx/golden/links.docx
index 11e52c4b1..e53889cfb 100644
--- a/test/docx/golden/links.docx
+++ b/test/docx/golden/links.docx
Binary files differ
diff --git a/test/docx/golden/lists.docx b/test/docx/golden/lists.docx
index 7667990c4..5dbe298b7 100644
--- a/test/docx/golden/lists.docx
+++ b/test/docx/golden/lists.docx
Binary files differ
diff --git a/test/docx/golden/lists_continuing.docx b/test/docx/golden/lists_continuing.docx
index 3e8c6d2b2..194181288 100644
--- a/test/docx/golden/lists_continuing.docx
+++ b/test/docx/golden/lists_continuing.docx
Binary files differ
diff --git a/test/docx/golden/lists_multiple_initial.docx b/test/docx/golden/lists_multiple_initial.docx
index 05a7cf060..6e0b634f7 100644
--- a/test/docx/golden/lists_multiple_initial.docx
+++ b/test/docx/golden/lists_multiple_initial.docx
Binary files differ
diff --git a/test/docx/golden/lists_restarting.docx b/test/docx/golden/lists_restarting.docx
index f5ae4a384..477178e77 100644
--- a/test/docx/golden/lists_restarting.docx
+++ b/test/docx/golden/lists_restarting.docx
Binary files differ
diff --git a/test/docx/golden/nested_anchors_in_header.docx b/test/docx/golden/nested_anchors_in_header.docx
index d02c77271..51110356e 100644
--- a/test/docx/golden/nested_anchors_in_header.docx
+++ b/test/docx/golden/nested_anchors_in_header.docx
Binary files differ
diff --git a/test/docx/golden/notes.docx b/test/docx/golden/notes.docx
index f7fdcbe11..b6206cdf5 100644
--- a/test/docx/golden/notes.docx
+++ b/test/docx/golden/notes.docx
Binary files differ
diff --git a/test/docx/golden/raw-blocks.docx b/test/docx/golden/raw-blocks.docx
index ae7f8f1f0..07b576080 100644
--- a/test/docx/golden/raw-blocks.docx
+++ b/test/docx/golden/raw-blocks.docx
Binary files differ
diff --git a/test/docx/golden/raw-bookmarks.docx b/test/docx/golden/raw-bookmarks.docx
index 5e433b736..d46095eb7 100644
--- a/test/docx/golden/raw-bookmarks.docx
+++ b/test/docx/golden/raw-bookmarks.docx
Binary files differ
diff --git a/test/docx/golden/table_one_row.docx b/test/docx/golden/table_one_row.docx
index d404878c6..7caba4e93 100644
--- a/test/docx/golden/table_one_row.docx
+++ b/test/docx/golden/table_one_row.docx
Binary files differ
diff --git a/test/docx/golden/table_with_list_cell.docx b/test/docx/golden/table_with_list_cell.docx
index 79c395262..6aaa6da61 100644
--- a/test/docx/golden/table_with_list_cell.docx
+++ b/test/docx/golden/table_with_list_cell.docx
Binary files differ
diff --git a/test/docx/golden/tables.docx b/test/docx/golden/tables.docx
index df9680773..5746c5ad0 100644
--- a/test/docx/golden/tables.docx
+++ b/test/docx/golden/tables.docx
Binary files differ
diff --git a/test/docx/golden/track_changes_deletion.docx b/test/docx/golden/track_changes_deletion.docx
index bb73b82f6..5f22dccc6 100644
--- a/test/docx/golden/track_changes_deletion.docx
+++ b/test/docx/golden/track_changes_deletion.docx
Binary files differ
diff --git a/test/docx/golden/track_changes_insertion.docx b/test/docx/golden/track_changes_insertion.docx
index 7df484aaa..ab5c4f56d 100644
--- a/test/docx/golden/track_changes_insertion.docx
+++ b/test/docx/golden/track_changes_insertion.docx
Binary files differ
diff --git a/test/docx/golden/track_changes_move.docx b/test/docx/golden/track_changes_move.docx
index d717b93ab..085f33162 100644
--- a/test/docx/golden/track_changes_move.docx
+++ b/test/docx/golden/track_changes_move.docx
Binary files differ
diff --git a/test/docx/golden/track_changes_scrubbed_metadata.docx b/test/docx/golden/track_changes_scrubbed_metadata.docx
index 791182db2..1ac86d5c8 100644
--- a/test/docx/golden/track_changes_scrubbed_metadata.docx
+++ b/test/docx/golden/track_changes_scrubbed_metadata.docx
Binary files differ
diff --git a/test/docx/golden/unicode.docx b/test/docx/golden/unicode.docx
index b64a7b58e..c2c443b19 100644
--- a/test/docx/golden/unicode.docx
+++ b/test/docx/golden/unicode.docx
Binary files differ
diff --git a/test/docx/golden/verbatim_subsuper.docx b/test/docx/golden/verbatim_subsuper.docx
index b5116d1a8..5ea18d32e 100644
--- a/test/docx/golden/verbatim_subsuper.docx
+++ b/test/docx/golden/verbatim_subsuper.docx
Binary files differ