output: Add support for captions.
[pspp] / src / output / odt.c
index d0860585cd40c35219bfad9533803770e74613bd..a29c045d0b67e8920344a0e3e0b6f6a5f99f4db8 100644 (file)
@@ -455,16 +455,17 @@ write_table (struct odt_driver *odt, const struct table_item *item)
 {
   const struct table *tab = table_item_get_table (item);
   const char *caption = table_item_get_caption (item);
+  const char *title = table_item_get_title (item);
   int r, c;
 
   /* Write a heading for the table */
-  if (caption != NULL)
+  if (title != NULL)
     {
       xmlTextWriterStartElement (odt->content_wtr, _xml("text:h"));
       xmlTextWriterWriteFormatAttribute (odt->content_wtr,
                                          _xml("text:outline-level"), "%d", 2);
       xmlTextWriterWriteString (odt->content_wtr,
-                                _xml (table_item_get_caption (item)) );
+                                _xml (table_item_get_title (item)) );
       xmlTextWriterEndElement (odt->content_wtr);
     }
 
@@ -560,6 +561,18 @@ write_table (struct odt_driver *odt, const struct table_item *item)
     }
 
   xmlTextWriterEndElement (odt->content_wtr); /* table */
+
+  /* Write a caption for the table */
+  if (caption != NULL)
+    {
+      xmlTextWriterStartElement (odt->content_wtr, _xml("text:h"));
+      xmlTextWriterWriteFormatAttribute (odt->content_wtr,
+                                         _xml("text:outline-level"), "%d", 2);
+      xmlTextWriterWriteString (odt->content_wtr,
+                                _xml (table_item_get_caption (item)) );
+      xmlTextWriterEndElement (odt->content_wtr);
+    }
+
 }
 
 static void