aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Writers/RTF.hs4
-rw-r--r--tests/tables.rtf79
2 files changed, 82 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/RTF.hs b/src/Text/Pandoc/Writers/RTF.hs
index 9f3b9de2a..b9ef2a29a 100644
--- a/src/Text/Pandoc/Writers/RTF.hs
+++ b/src/Text/Pandoc/Writers/RTF.hs
@@ -173,7 +173,9 @@ blockToRTF indent _ HorizontalRule =
blockToRTF indent alignment (Header level lst) = rtfPar indent 0 alignment $
"\\b \\fs" ++ (show (40 - (level * 4))) ++ " " ++ inlineListToRTF lst
blockToRTF indent alignment (Table caption aligns sizes headers rows) =
- tableRowToRTF True indent aligns sizes headers ++
+ (if all null headers
+ then ""
+ else tableRowToRTF True indent aligns sizes headers) ++
concatMap (tableRowToRTF False indent aligns sizes) rows ++
rtfPar indent 0 alignment (inlineListToRTF caption)
diff --git a/tests/tables.rtf b/tests/tables.rtf
index bd0a88467..e7c1e9f60 100644
--- a/tests/tables.rtf
+++ b/tests/tables.rtf
@@ -278,4 +278,83 @@
}
\intbl\row}
{\pard \ql \f0 \sa180 \li0 \fi0 \par}
+{\pard \ql \f0 \sa180 \li0 \fi0 Table without column headers:\par}
+{
+\trowd \trgaph120
+\cellx2160\cellx4320\cellx6480\cellx8640
+\trkeep\intbl
+{
+{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 12\par}
+\cell}
+{\intbl {\pard \ql \f0 \sa0 \li0 \fi0 12\par}
+\cell}
+{\intbl {\pard \qc \f0 \sa0 \li0 \fi0 12\par}
+\cell}
+{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 12\par}
+\cell}
+}
+\intbl\row}
+{
+\trowd \trgaph120
+\cellx2160\cellx4320\cellx6480\cellx8640
+\trkeep\intbl
+{
+{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 123\par}
+\cell}
+{\intbl {\pard \ql \f0 \sa0 \li0 \fi0 123\par}
+\cell}
+{\intbl {\pard \qc \f0 \sa0 \li0 \fi0 123\par}
+\cell}
+{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 123\par}
+\cell}
+}
+\intbl\row}
+{
+\trowd \trgaph120
+\cellx2160\cellx4320\cellx6480\cellx8640
+\trkeep\intbl
+{
+{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 1\par}
+\cell}
+{\intbl {\pard \ql \f0 \sa0 \li0 \fi0 1\par}
+\cell}
+{\intbl {\pard \qc \f0 \sa0 \li0 \fi0 1\par}
+\cell}
+{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 1\par}
+\cell}
+}
+\intbl\row}
+{\pard \ql \f0 \sa180 \li0 \fi0 \par}
+{\pard \ql \f0 \sa180 \li0 \fi0 Multiline table without column headers:\par}
+{
+\trowd \trgaph120
+\cellx1296\cellx2484\cellx3888\cellx6804
+\trkeep\intbl
+{
+{\intbl {\pard \qc \f0 \sa0 \li0 \fi0 First\par}
+\cell}
+{\intbl {\pard \ql \f0 \sa0 \li0 \fi0 row\par}
+\cell}
+{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 12.0\par}
+\cell}
+{\intbl {\pard \ql \f0 \sa0 \li0 \fi0 Example of a row that spans multiple lines.\par}
+\cell}
+}
+\intbl\row}
+{
+\trowd \trgaph120
+\cellx1296\cellx2484\cellx3888\cellx6804
+\trkeep\intbl
+{
+{\intbl {\pard \qc \f0 \sa0 \li0 \fi0 Second\par}
+\cell}
+{\intbl {\pard \ql \f0 \sa0 \li0 \fi0 row\par}
+\cell}
+{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 5.0\par}
+\cell}
+{\intbl {\pard \ql \f0 \sa0 \li0 \fi0 Here's another one. Note the blank line between rows.\par}
+\cell}
+}
+\intbl\row}
+{\pard \ql \f0 \sa180 \li0 \fi0 \par}