After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 604549 - Implement --export-file-per-sheet in ssconvert
Implement --export-file-per-sheet in ssconvert
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: General
unspecified
Other All
: Normal enhancement
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2009-12-14 15:01 UTC by Gabriel Kerneis
Modified: 2009-12-15 09:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to support the --export-file-per-sheet option of ssconvert (1.24 KB, text/x-c)
2009-12-14 15:01 UTC, Gabriel Kerneis
  Details
Better patch to support the --export-file-per-sheet option of ssconvert (15.22 KB, patch)
2009-12-14 17:39 UTC, Gabriel Kerneis
none Details | Review
Better patch to support the --export-file-per-sheet option of ssconvert (1.04 KB, patch)
2009-12-14 17:41 UTC, Gabriel Kerneis
committed Details | Review

Description Gabriel Kerneis 2009-12-14 15:01:32 UTC
Created attachment 149703 [details]
Patch to support the --export-file-per-sheet option of ssconvert

Hi,

I just implemented the missing --export-file-per-sheet option to ssconvert.

This is the very first time I dive into gnumeric's source code
so there are probably many coding style issues and so on, but at least it seems to work.

$ ssconvert --export-file-per-sheet -T Gnumeric_stf:stf_csv test.xls test.csv
$ ls
test.xls test.csv.0 test.csv.1 test.csv.2 test.csv.3

Patch is attached.

Regards,

                                            Gabriel Kerneis
Comment 1 Andreas J. Guelzow 2009-12-14 15:30:54 UTC
It looks to me that if we were to apply this bug and ssconvert_range were true we would not anymore export any file (since the export is moved into the "else" of the second if).
Comment 2 Morten Welinder 2009-12-14 16:43:30 UTC
Andreas: not a major concern: --export-range is a hidden option for
use in the test suite.
Comment 3 Andreas J. Guelzow 2009-12-14 17:29:48 UTC
Morten: but the patch would be quite easy to fix anyways
Comment 4 Gabriel Kerneis 2009-12-14 17:38:22 UTC
The problem was more general, thank you for spotting it.

Here is an enhanced patch.
Comment 5 Gabriel Kerneis 2009-12-14 17:39:07 UTC
Created attachment 149713 [details] [review]
Better patch to support the --export-file-per-sheet option of ssconvert
Comment 6 Gabriel Kerneis 2009-12-14 17:41:39 UTC
Created attachment 149714 [details] [review]
Better patch to support the --export-file-per-sheet option of ssconvert

Oops, the previous one was ssconvert.c instead of the patch. Sorry.
Comment 7 Andreas J. Guelzow 2009-12-15 07:35:43 UTC
Which source code version are you using? There seems to be a 70 line offset between your patch and the current version.
Comment 8 Andreas J. Guelzow 2009-12-15 07:59:20 UTC
With the patch 
ssconvert --export-file-per-sheet  Book1.gnumeric Book.html
creates two files Book.html.1 and Book.html.2 but both contain both sheets.
Comment 9 Andreas J. Guelzow 2009-12-15 08:09:09 UTC
Comment on attachment 149714 [details] [review]
Better patch to support the --export-file-per-sheet option of ssconvert

There are still some things to do, for example,the html situation of a file per sheet containing each all sheets and the situation that if no filename is specified the code appears not to be reached.
Comment 10 Gabriel Kerneis 2009-12-15 09:16:15 UTC
(In reply to comment #9)
> There are still some things to do, for example,the html situation of a file per
> sheet containing each all sheets

I guess this is a bug in the html plugin, which should set the save scope to GO_FILE_SAVE_WORKBOOK (if I understand the code correctly — or the condition line 602 needs to be changed, but do not know gnumeric well enough to suggest a fix).

http://git.gnome.org/cgit/gnumeric/tree/src/ssconvert.c#n602

I guess the save_scope must be specified in http://git.gnome.org/cgit/gnumeric/tree/plugins/html/plugin.xml.in but I cannot find what the default value is.


> and the situation that if no filename is
> specified the code appears not to be reached.

I do not understand this. Here it works (of course, you have to give the expected extension if you do not provide any filename, otherwise ssconvert cannot guess the right exporter):

$ ssconvert --export-file-per-sheet -T Gnumeric_stf:stf_csv raw/EXPAD08.xls
$ ls raw/
EXPAD08.csv.0  EXPAD08.csv.1  EXPAD08.csv.2  EXPAD08.csv.3  EXPAD08.xls
Comment 11 Andreas J. Guelzow 2009-12-15 09:27:37 UTC
you are right the issue seems to be that some of the save_scope are not what I would expect. Since this is really a quite separate issue, we can consider this fixed. Thank you.