+
+ if (footnote_idx)
+ {
+ size_t i;
+
+ fputs ("\nFootnotes:\n", csv->file);
+
+ footnote_idx = 0;
+ for (y = 0; y < table_nr (t); y++)
+ {
+ struct table_cell cell;
+ for (x = 0; x < table_nc (t); x = cell.d[TABLE_HORZ][1])
+ {
+ table_get_cell (t, x, y, &cell);
+
+ if (x == cell.d[TABLE_HORZ][0] && y == cell.d[TABLE_VERT][0])
+ for (i = 0; i < cell.n_contents; i++)
+ {
+ const struct cell_contents *c = &cell.contents[i];
+ int j;
+
+ for (j = 0; j < c->n_footnotes; j++)
+ {
+ char marker[16];
+
+ str_format_26adic (++footnote_idx, false,
+ marker, sizeof marker);
+ csv_output_field (csv, marker);
+ fputs (csv->separator, csv->file);
+ csv_output_field (csv, c->footnotes[j]);
+ putc ('\n', csv->file);
+ }
+ }
+ table_cell_free (&cell);
+ }
+ }
+ }