diff options
author | Eike Rathke <erack@redhat.com> | 2021-07-15 10:37:57 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2021-07-15 13:02:04 +0200 |
commit | fda91f8be16ba760e360940ebafd6244c648cb8c (patch) | |
tree | 35c56bba166691e0ad63792c69c940fe6cf7919e /desktop | |
parent | 246c766cadcafc5d26f39f832a683a13f2dfe40b (diff) |
Related: tdf#135762 Allow --convert-to csv to specify 1-based sheet number
Same multifile mechanism as for -1 all sheets is used, so
soffice --convert-to csv:"Text - txt - csv (StarCalc)":44,34,UTF8,1,,0,false,true,false,false,false,2 sample.ods
writes a file sample-Sheet2.csv
Change-Id: Ib9248c9561e4e340c88458ac5dfd159e443a4cfd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118971
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/dispatchwatcher.cxx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 8541c273cc83..1c4d878614c5 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -625,11 +625,20 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest if (sFilterName == "Text - txt - csv (StarCalc)") { sal_Int32 nIdx(0); - // If the 11th token token is '-1' then we export a file + // If the 11th token is '-1' then we export a file // per sheet where the file name is based on the suggested // output filename concatenated with the sheet name, so adjust // the output and overwrite messages - bMultiFileTarget = sFilterOptions.getToken(11, ',', nIdx) == "-1"; + // If the 11th token is not present or numeric 0 then the + // default sheet is exported with the output filename. If it + // is numeric >0 then that sheet (1-based) with the output + // filename concatenated with the sheet name. So even if + // that is a single file, the multi file target mechanism is + // used. + const OUString aTok(sFilterOptions.getToken(11, ',', nIdx)); + // Actual validity is checked in Calc, here just check for + // presence of numeric value at start. + bMultiFileTarget = (!aTok.isEmpty() && aTok.toInt32() != 0); } conversionProperties[1].Value <<= sFilterName; |