GNOME Bugzilla – Bug 604549
Implement --export-file-per-sheet in ssconvert
Last modified: 2009-12-15 09:27:37 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
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).
Andreas: not a major concern: --export-range is a hidden option for use in the test suite.
Morten: but the patch would be quite easy to fix anyways
The problem was more general, thank you for spotting it. Here is an enhanced patch.
Created attachment 149713 [details] [review] Better patch to support the --export-file-per-sheet option of ssconvert
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.
Which source code version are you using? There seems to be a 70 line offset between your patch and the current version.
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 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.
(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
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.