Commit ca1f917a authored by Morten Welinder's avatar Morten Welinder

ssconvert: make it possible to split files into multiple .txt files.

cvs has long worked, but txt has a sheet selector and thus is different.
parent 2f58da86
2015-12-28 Morten Welinder <terra@gnome.org>
* src/ssconvert.c (convert): When separating sheets, move current
sheet to the front. See bug #694408.
* src/stf-export.c (gnm_stf_file_saver_save): If we add current
sheet, remove it at the end.
2015-12-28 Morten Welinder <terra@gnome.org>
* configure.ac: Post-release bump.
......
Gnumeric 1.12.27
Morten:
* Teach ssconvert to split sheets into separate .txt files [#694408]
--------------------------------------------------------------------------
Gnumeric 1.12.26
......
......@@ -803,6 +803,7 @@ convert (char const *inarg, char const *outarg, char const *mergeargs[],
if (ssconvert_one_file_per_sheet) {
GSList *ptr, *sheets;
char *template;
res = 0;
template = strchr (outarg, '%')
......@@ -813,8 +814,21 @@ convert (char const *inarg, char const *outarg, char const *mergeargs[],
for (ptr = sheets; ptr; ptr = ptr->next) {
Sheet *sheet = ptr->data;
char *tmpfile = resolve_template (template, sheet);
int oldn = sheet->index_in_wb;
/*
* HACK: (bug 694408).
*
* We don't have a good way of specifying the
* sheet. Move it to the front and select
* it. That will at least make cvs and txt
* exporters reliable find it.
*/
workbook_sheet_move (sheet, -oldn);
wb_view_sheet_focus (wbv, sheet);
res = !wb_view_save_as (wbv, fs, tmpfile, cc);
workbook_sheet_move (sheet, +oldn);
g_free (tmpfile);
if (res)
break;
......
......@@ -605,7 +605,7 @@ GSF_CLASS (GnmStfExport, gnm_stf_export,
* gnm_stf_get_stfe:
* @obj: #GObject with a #GnmStfExport attached as data.
*
* If non is found, a new one is created ans attached to @obj.
* If none is found, a new one is created and attached to @obj.
* Returns: (transfer none): the #GnmStfExport.
**/
GnmStfExport *
......@@ -665,6 +665,7 @@ gnm_stf_file_saver_save (G_GNUC_UNUSED GOFileSaver const *fs, GOIOContext *conte
Workbook *wb = wb_view_get_workbook (wbv);
GnmStfExport *stfe = gnm_stf_get_stfe (G_OBJECT (wb));
GsfOutput *dummy_sink;
gboolean nosheets;
/* TODO: move this GUI dependent code out of this
* filesaver into gui-file.c. After this, remove includes (see above). */
......@@ -677,7 +678,8 @@ gnm_stf_file_saver_save (G_GNUC_UNUSED GOFileSaver const *fs, GOIOContext *conte
}
}
if (!stfe->sheet_list)
nosheets = (stfe->sheet_list == NULL);
if (nosheets)
gnm_stf_export_options_sheet_list_add
(stfe, wb_view_cur_sheet (wbv));
......@@ -690,6 +692,9 @@ gnm_stf_file_saver_save (G_GNUC_UNUSED GOFileSaver const *fs, GOIOContext *conte
dummy_sink = gsf_output_memory_new ();
g_object_set (G_OBJECT (stfe), "sink", dummy_sink, NULL);
g_object_unref (dummy_sink);
if (nosheets)
gnm_stf_export_options_sheet_list_clear (stfe);
}
static gboolean
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment