summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Writers/OpenDocument.hs4
-rw-r--r--tests/tables.opendocument84
2 files changed, 87 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs
index f057cf1cd..e3ed913d4 100644
--- a/src/Text/Pandoc/Writers/OpenDocument.hs
+++ b/src/Text/Pandoc/Writers/OpenDocument.hs
@@ -313,7 +313,9 @@ blockToOpenDocument o bs
captionDoc <- if null c
then return empty
else withParagraphStyle o "Caption" [Para c]
- th <- colHeadsToOpenDocument o name (map fst paraHStyles) h
+ th <- if all null h
+ then return empty
+ else colHeadsToOpenDocument o name (map fst paraHStyles) h
tr <- mapM (tableRowToOpenDocument o name (map fst paraStyles)) r
return $ inTags True "table:table" [ ("table:name" , name)
, ("table:style-name", name)
diff --git a/tests/tables.opendocument b/tests/tables.opendocument
index 872890b48..6cbfa00eb 100644
--- a/tests/tables.opendocument
+++ b/tests/tables.opendocument
@@ -298,3 +298,87 @@
</table:table-cell>
</table:table-row>
</table:table>
+<text:p text:style-name="Text_20_body">Table without column headers:</text:p>
+<table:table table:name="Table6" table:style-name="Table6">
+ <table:table-column table:style-name="Table6.A" />
+ <table:table-column table:style-name="Table6.B" />
+ <table:table-column table:style-name="Table6.C" />
+ <table:table-column table:style-name="Table6.D" />
+ <table:table-row>
+ <table:table-cell table:style-name="Table6.A1" office:value-type="string">
+ <text:p text:style-name="P24">12</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="Table6.A1" office:value-type="string">
+ <text:p text:style-name="Table_20_Contents">12</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="Table6.A1" office:value-type="string">
+ <text:p text:style-name="P25">12</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="Table6.A1" office:value-type="string">
+ <text:p text:style-name="P26">12</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row>
+ <table:table-cell table:style-name="Table6.A1" office:value-type="string">
+ <text:p text:style-name="P24">123</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="Table6.A1" office:value-type="string">
+ <text:p text:style-name="Table_20_Contents">123</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="Table6.A1" office:value-type="string">
+ <text:p text:style-name="P25">123</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="Table6.A1" office:value-type="string">
+ <text:p text:style-name="P26">123</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row>
+ <table:table-cell table:style-name="Table6.A1" office:value-type="string">
+ <text:p text:style-name="P24">1</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="Table6.A1" office:value-type="string">
+ <text:p text:style-name="Table_20_Contents">1</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="Table6.A1" office:value-type="string">
+ <text:p text:style-name="P25">1</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="Table6.A1" office:value-type="string">
+ <text:p text:style-name="P26">1</text:p>
+ </table:table-cell>
+ </table:table-row>
+</table:table>
+<text:p text:style-name="Text_20_body">Multiline table without column headers:</text:p>
+<table:table table:name="Table7" table:style-name="Table7">
+ <table:table-column table:style-name="Table7.A" />
+ <table:table-column table:style-name="Table7.B" />
+ <table:table-column table:style-name="Table7.C" />
+ <table:table-column table:style-name="Table7.D" />
+ <table:table-row>
+ <table:table-cell table:style-name="Table7.A1" office:value-type="string">
+ <text:p text:style-name="P29">First</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="Table7.A1" office:value-type="string">
+ <text:p text:style-name="Table_20_Contents">row</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="Table7.A1" office:value-type="string">
+ <text:p text:style-name="P30">12.0</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="Table7.A1" office:value-type="string">
+ <text:p text:style-name="Table_20_Contents">Example of a row that spans multiple lines.</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row>
+ <table:table-cell table:style-name="Table7.A1" office:value-type="string">
+ <text:p text:style-name="P29">Second</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="Table7.A1" office:value-type="string">
+ <text:p text:style-name="Table_20_Contents">row</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="Table7.A1" office:value-type="string">
+ <text:p text:style-name="P30">5.0</text:p>
+ </table:table-cell>
+ <table:table-cell table:style-name="Table7.A1" office:value-type="string">
+ <text:p text:style-name="Table_20_Contents">Here's another one. Note the blank line between rows.</text:p>
+ </table:table-cell>
+ </table:table-row>
+</table:table>