Hello community,

here is the log from the commit of package octave-forge-io for openSUSE:Factory 
checked in at 2015-10-26 12:48:54
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/octave-forge-io (Old)
 and      /work/SRC/openSUSE:Factory/.octave-forge-io.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "octave-forge-io"

Changes:
--------
--- /work/SRC/openSUSE:Factory/octave-forge-io/octave-forge-io.changes  
2015-09-30 05:53:15.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.octave-forge-io.new/octave-forge-io.changes     
2015-10-26 12:48:59.000000000 +0100
@@ -1,0 +2,6 @@
+Thu Oct 22 20:35:44 UTC 2015 - [email protected]
+
+- Update to version 2.2.11
+  * Bug fixes
+
+-------------------------------------------------------------------

Old:
----
  io-2.2.10.tar.gz

New:
----
  io-2.2.11.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ octave-forge-io.spec ++++++
--- /var/tmp/diff_new_pack.PhlzTk/_old  2015-10-26 12:49:00.000000000 +0100
+++ /var/tmp/diff_new_pack.PhlzTk/_new  2015-10-26 12:49:00.000000000 +0100
@@ -18,7 +18,7 @@
 
 %define octpkg  io
 Name:           octave-forge-%{octpkg}
-Version:        2.2.10
+Version:        2.2.11
 Release:        0
 Summary:        Input/Output in external formats from Octave
 License:        GPL-3.0+ and BSD-2-Clause

++++++ io-2.2.10.tar.gz -> io-2.2.11.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/io/DESCRIPTION new/io/DESCRIPTION
--- old/io/DESCRIPTION  2015-09-23 22:40:08.000000000 +0200
+++ new/io/DESCRIPTION  2015-10-21 23:01:37.000000000 +0200
@@ -1,6 +1,6 @@
 Name: io
-Version: 2.2.10
-Date: 2015-09-24
+Version: 2.2.11
+Date: 2015-10-22
 Author: various authors
 Maintainer: Philip Nienhuis <[email protected]>
 Title: Input/Output
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/io/NEWS new/io/NEWS
--- old/io/NEWS 2015-09-23 22:39:47.000000000 +0200
+++ new/io/NEWS 2015-10-21 23:00:48.000000000 +0200
@@ -1,6 +1,20 @@
 Summary of important user-visible changes for releases of the io package
 
 ===============================================================================
+io-2.2.11   Release Date: 2015-10-22 Release Manager: Philip Nienhuis
+===============================================================================
+
+Primarily a bug fix release
+
+*** Bug fixes:
+    - More robust Named range code processing & code simplifications
+    - odsfinfo.m / gnumeric: fix errors when sheet has no Named ranges
+    - xlsopen.m: don't allow .xlsx to be opened by OXS interface (OpenXLS
+      .xlsx processing is immature while it works fine for plain .xls/BIFF8)
+    - odsfinfo.m: implement fformat and nmranges output arguments
+    - some cosmetic issues and spelling
+
+===============================================================================
 io-2.2.10   Release Date: 2015-09-24 Release Manager: Philip Nienhuis
 ===============================================================================
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/io/inst/chk_spreadsheet_support.m 
new/io/inst/chk_spreadsheet_support.m
--- old/io/inst/chk_spreadsheet_support.m       2015-09-23 20:00:57.000000000 
+0200
+++ new/io/inst/chk_spreadsheet_support.m       2015-10-20 19:16:17.000000000 
+0200
@@ -168,7 +168,7 @@
     endif
     return
   elseif (dbug > 0)
-    printf ('\n');
+    printf ("\n");
   endif
 
   interfaces = {"COM", "POI", "POI+OOXML", "JXL", "OXS", "OTK", "JOD", "UNO", 
"OCT"}; 
@@ -247,7 +247,7 @@
         printf ("  Maximum JVM memory: %5d MiB; ", jmem);
         if (jmem < 400)
           printf ("should better be at least 400 MB!\n");
-          printf ('    Hint: adapt setting -Xmx in file "java.opts" (supposed 
to be here:)\n');
+          printf ("    Hint: adapt setting -Xmx in file 'java.opts' (supposed 
to be here:)\n");
           printf ("    %s\n", [matlabroot filesep "share" filesep "octave" 
filesep "packages" filesep "java-<version>" filesep "java.opts\n"]);
         else
           printf ("sufficient.\n");
@@ -635,27 +635,27 @@
   if (isempty (file))
     ## Still not found...
     if (dbug > 2)
-      printf ('  ? %s<...>.jar ?\n', jarname);
+      printf ("  ? %s<...>.jar ?\n", jarname);
     endif
   elseif (stat ([path_to_jars filesep file]).size < 1024)
     ## Probably too small for a jar => apparently a symlink
     if (dbug > 2)
-      printf ('  File %s is probably a symlink ... \n', file);
+      printf ("  File %s is probably a symlink ... \n", file);
     endif
   else
     ## FIXME: cache subdir in file name to speed up search
     if (dbug > 2)
-      printf ('  Found %s, adding it to javaclasspath ... ', file);
+      printf ("  Found %s, adding it to javaclasspath ... ", file);
     endif
     try
       javaaddpath ([path_to_jars filesep file]);
       if (dbug > 2)
-        printf ('OK\n');
+        printf ("OK\n");
       endif
       retval = [path_to_jars filesep file];
     catch
       if (dbug > 2)
-        printf ('FAILED\n');
+        printf ("FAILED\n");
       endif
     end_try_catch
   endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/io/inst/oct2ods.m new/io/inst/oct2ods.m
--- old/io/inst/oct2ods.m       2015-09-23 22:04:53.000000000 +0200
+++ new/io/inst/oct2ods.m       2015-10-15 22:41:19.000000000 +0200
@@ -135,28 +135,10 @@
     error ("oct2ods: character string (range) expected for arg # 4\n");
   elseif (isempty (crange))
     crange = "";
-  else
-    ## FIXME the following stanza can be made into a separate func
+  elseif (! isempty (crange))
     ## Check for range name and convert it to range & optionally sheet
     ## 1. Check if it matches a range
-    mtch = cell2mat (regexp (crange, ...
-                     '(^[A-Za-z]+[0-9]+){1}(:[A-Za-z]+[0-9]+$)?', "tokens"));
-    if (! isempty (mtch) && ! strcmp ([mtch{:}], crange))
-      ## Apparently not a range. Try range names
-      if (! isfield (xls, "nmranges"))
-        xls.nmranges = getnmranges (xls);
-      endif
-      idx = strmatch (crange, xls.nmranges(:, 1));
-      if (isempty (idx))
-        error ("oct2xls: no range '%s' in workbook", crange);
-      else
-        ## Get range and -optionally- sheet it refers to
-        crange = xls.nmranges{idx, 3};
-        if (! isempty (xls.nmranges{idx, 2}))
-          wsh = xls.nmranges{idx, 2};
-        endif
-      endif
-    endif
+    [crange, wsh, ods] = chknmrange (ods, crange, wsh);
   endif
 
   ## Various options 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/io/inst/oct2xls.m new/io/inst/oct2xls.m
--- old/io/inst/oct2xls.m       2015-09-23 22:03:52.000000000 +0200
+++ new/io/inst/oct2xls.m       2015-10-15 22:41:59.000000000 +0200
@@ -136,28 +136,10 @@
     error ("oct2xls: character string expected for arg # 4 (range)\n");
   elseif (isempty (crange))
     crange = "";
-  else
-    ## FIXME the following stanza can be made into a separate func
+  elseif (! isempty (crange))
     ## Check for range name and convert it to range & optionally sheet
     ## 1. Check if it matches a range
-    mtch = cell2mat (regexp (crange, ...
-                     '(^[A-Za-z]+[0-9]+){1}(:[A-Za-z]+[0-9]+$)?', "tokens"));
-    if (! isempty (mtch) && ! strcmp ([mtch{:}], crange))
-      ## Apparently not a range. Try range names
-      if (! isfield (xls, "nmranges"))
-        xls.nmranges = getnmranges (xls);
-      endif
-      idx = strmatch (crange, xls.nmranges(:, 1));
-      if (isempty (idx))
-        error ("oct2xls: no range '%s' in workbook", crange);
-      else
-        ## Get range and -optionally- sheet it refers to
-        crange = xls.nmranges{idx, 3};
-        if (! isempty (xls.nmranges{idx, 2}))
-          wsh = xls.nmranges{idx, 2};
-        endif
-      endif
-    endif
+    [crange, wsh, xls] = chknmrange (xls, crange, wsh);
   endif
 
   ## Various options 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/io/inst/ods2oct.m new/io/inst/ods2oct.m
--- old/io/inst/ods2oct.m       2015-09-23 22:03:21.000000000 +0200
+++ new/io/inst/ods2oct.m       2015-10-15 22:41:53.000000000 +0200
@@ -127,28 +127,10 @@
   ## Check range
   if (! (isempty (datrange) || ischar (datrange)))
     error ("Character string (range) expected for arg # 3\n");
-  else
-    ## FIXME the following stanza can be made into a separate func
+  elseif (! isempty (datrange))
     ## Check for range name and convert it to range & optionally sheet
     ## 1. Check if it matches a range
-    mtch = cell2mat (regexp (datrange, ...
-                     '(^[A-Za-z]+[0-9]+){1}(:[A-Za-z]+[0-9]+$)?', "tokens"));
-    if (! isempty (mtch) && ! strcmp ([mtch{:}], datrange))
-      ## Apparently not a range. Try range names
-      if (! isfield (xls, "nmranges"))
-        xls.nmranges = getnmranges (xls);
-      endif
-      idx = strmatch (datrange, xls.nmranges(:, 1));
-      if (isempty (idx))
-        error ("oct2xls: no range '%s' in workbook", crange);
-      else
-        ## Get range and -optionally- sheet it refers to
-        datrange = xls.nmranges{idx, 3};
-        if (! isempty (xls.nmranges{idx, 2}))
-          wsh = xls.nmranges{idx, 2};
-        endif
-      endif
-    endif
+    [datrange, wsh, ods] = chknmrange (ods, datrange, wsh);
   endif
   ## Check & setup options struct
   if (nargin < 4 || isempty (spsh_opts))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/io/inst/odsfinfo.m new/io/inst/odsfinfo.m
--- old/io/inst/odsfinfo.m      2015-09-23 22:02:50.000000000 +0200
+++ new/io/inst/odsfinfo.m      2015-10-03 17:21:17.000000000 +0200
@@ -17,6 +17,7 @@
 ## @deftypefn {Function File} [@var{filetype}] = odsfinfo (@var{filename} [, 
@var{reqintf}])
 ## @deftypefnx {Function File} [@var{filetype}, @var{sh_names}] = odsfinfo 
(@var{filename} [, @var{reqintf}])
 ## @deftypefnx {Function File} [@var{filetype}, @var{sh_names}, 
@var{nmranges}] = odsfinfo (@var{filename} [, @var{reqintf}])
+## @deftypefnx {Function File} [@var{filetype}, @var{sh_names}, @var{fformat}, 
@var{nmranges}] = odsfinfo (@var{filename} [, @var{reqintf}])
 ## Query an OpenOffice_org or Gnumeric spreadsheet file @var{filename}
 ## (with ods or gnumeric suffix) for some info about its contents.
 ##
@@ -29,6 +30,9 @@
 ## array) of sheet names contained in @var{filename}, in the order (from left
 ## to right) in which they occur in the sheet stack.
 ##
+## Optional output argument @var{fformat} is a string describing the file
+## contents. 
+##
 ## Optional return argument @var{nmranges} returns a list of Named ranges
 ## defined in the spreadsheet, if any.
 ##
@@ -68,7 +72,7 @@
 ## Author: Philip Nienhuis <pr.nienhuis at users.sf.net>
 ## Created: 2009-12-17
 
-function [ filetype, sh_names ] = odsfinfo (filename, reqintf=[])
+function [ filetype, sh_names, fformat, nmranges ] = odsfinfo (filename, 
reqintf=[])
 
   persistent str2; str2 = "                                 "; # 33 spaces
   persistent lstr2; lstr2 = length (str2);
@@ -87,7 +91,11 @@
       filetype = "OpenOffice.org Calc Document";
     case {"gnumeric", ".gnumeric"}
       filetype = "Gnumeric spreadsheet";
+    case {"xls", "xlsx", "xlsm", ".xlsb", ".xls", ".xlsx", ".xlsm", ".xlsb"}
+      ## UNO (LO/OOo) and OCT also accept Excel spreadsheet files
+      filetype = "Microsoft Excel Spreadsheet";
     otherwise
+      filetype = "";
   endswitch
 
   ## To save execution time, only proceed if sheet names are wanted
@@ -113,8 +121,8 @@
     endif
   endif
 
+  sh_cnt = size (sh_names, 1);
   if (toscreen)
-    sh_cnt = size (sh_names, 1);
     # Echo sheet names to screen
     for ii=1:sh_cnt
       str1 = sprintf ("%3d: %s", ii, sh_names{ii, 1});
@@ -128,7 +136,7 @@
     ## Echo named ranges
     nmranges = getnmranges (ods);
     snmr = size (nmranges, 1);
-    if(snmr > 0)
+    if (snmr > 0)
       ## Find max length of entries
       nmrl = min (35, max ([cellfun("length", nmranges(:, 1)); 10]));
       shtl = min (31, max ([cellfun("length", nmranges(:, 2)); 6]));
@@ -140,6 +148,27 @@
         printf (frmt, nmranges(ii, 1:3){:});
       endfor
     endif
+
+  elseif (sh_cnt > 0 && nargout > 2)
+    ## Echo file format & named ranges
+    if (strcmpi (ods.filename(end-2:end), "ods"))
+      fformat = "ODSWorkbook";
+    elseif (strcmpi (ods.filename(end-2:end), "sxc"))
+      fformat = "StarOfficeWorkbook";
+    elseif (strcmpi (ods.filename(end-7:end), "gnumeric"))
+      fformat = "GnumericWorkbook";
+    ## Below options exist because Open?LibreOffice also swallow Excel files
+    elseif (strcmpi (ods.filename(end-2:end), "xls"))
+      fformat = "xlWorkbookNormal";
+    elseif (strcmpi (ods.filename(end-2:end), "csv"))
+      fformat = "xlCSV";        ## Works only with COM
+    elseif (strcmpi (ods.filename(end-3:end-1), "xls"))
+      fformat = "xlOpenXMLWorkbook";
+    else
+      fformat = "";
+    endif
+    nmranges = getnmranges (ods);
+ 
   endif
 
   ods = odsclose (ods);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/io/inst/odsopen.m new/io/inst/odsopen.m
--- old/io/inst/odsopen.m       2015-09-23 20:06:19.000000000 +0200
+++ new/io/inst/odsopen.m       2015-10-03 17:19:42.000000000 +0200
@@ -195,12 +195,20 @@
   ftype = 0;
   [~, ~, ext] = fileparts (filename);
   switch ext
+    case {"xls", ".xls"}
+      ## Because LibreOffice/OpenOffice.org accept Excel as well
+      ftype = 1;
+    case {"xlsx", "xlsm", ".xlsb", ".xlsx", ".xlsm", ".xlsb"}
+      ## Because LibreOffice/OpenOffice.org accept Excel as well
+      ftype = 2;
     case ".ods"               ## ODS 1.2
       ftype = 3;
     case ".sxc"               ## jOpenDocument (JOD) can read from .sxc files,
       ftype = 4;               ## but only if odfvsn = 2
     case ".gnumeric"          ## Zipped XML / gnumeric
       ftype = 5;
+    case ".csv"               ## ODS 1.2
+      ftype = 6;
     otherwise
   endswitch
 
@@ -227,17 +235,12 @@
               __JOD_spsh_open__ (ods, rw, filename, odssupport);
   endif
 
-  if (odsinterfaces.UNO && ! odssupport && ftype < 5)
-    ## Warn for LO / OOo stubbornness
-    if (ftype == 0 || ftype == 5 || ftype == 6)
-      warning ("UNO interface will write ODS format for unsupported file 
extensions\n")
-    endif
+  if (odsinterfaces.UNO && ! odssupport && ismember (ftype, [1:4, 6]))
     [ ods, odssupport, lastintf ] = ...
               __UNO_spsh_open__ (ods, rw, filename, odssupport);
   endif
 
-  if (odsinterfaces.OCT && ! odssupport && ...
-      (ftype == 2 || ftype == 3 || ftype == 5))
+  if (odsinterfaces.OCT && ! odssupport && ismember (ftype, [2, 3, 5]))
     [ ods, odssupport, lastintf ] = ...
               __OCT_spsh_open__ (ods, rw, filename, odssupport, ftype);
   endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/io/inst/private/__COM_chk_sprt__.m 
new/io/inst/private/__COM_chk_sprt__.m
--- old/io/inst/private/__COM_chk_sprt__.m      2015-09-23 20:22:30.000000000 
+0200
+++ new/io/inst/private/__COM_chk_sprt__.m      2015-10-20 19:17:28.000000000 
+0200
@@ -56,7 +56,6 @@
     elseif (dbug >= 1)
       printf ("(OF windows package is required for COM/ActiveX support)\n");
     endif
-    printf ("\n");
   end_try_catch
 
 endfunction
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/io/inst/private/__OCT_gnm_getnmranges__.m 
new/io/inst/private/__OCT_gnm_getnmranges__.m
--- old/io/inst/private/__OCT_gnm_getnmranges__.m       2015-09-23 
22:07:37.000000000 +0200
+++ new/io/inst/private/__OCT_gnm_getnmranges__.m       2015-10-03 
00:17:27.000000000 +0200
@@ -45,8 +45,10 @@
     st = xls.sheets.shtidx(ii);
     en = xls.sheets.shtidx(ii+1) - 1;
     names = reshape (cell2mat (regexp (xml(st:en), pttrn, "tokens")), [], 3);
-    names(:, 2) = repmat (xls.sheets.sh_names{ii}, size (names, 1), 1);
-    nmr = [nmr ; names];
+    if (! isempty (names))
+      names(:, 2) = repmat (xls.sheets.sh_names{ii}, size (names, 1), 1);
+      nmr = [nmr ; names];
+    endif
   endfor
   nmr(:, 3) = strrep (nmr(:, 3), "$", "");
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/io/inst/private/__OCT_oct2xlsx__.m 
new/io/inst/private/__OCT_oct2xlsx__.m
--- old/io/inst/private/__OCT_oct2xlsx__.m      2015-09-23 20:33:30.000000000 
+0200
+++ new/io/inst/private/__OCT_oct2xlsx__.m      2015-10-16 22:49:35.000000000 
+0200
@@ -363,8 +363,6 @@
   typearr = spsh_prstype (arrdat, onr, onc, [1:5], spsh_opts);
 
   if (all (typearr(:) == 1))        ## Numeric
-#   write arrdat to sheet%%WSH%%.xml
-#  
__OOXML_turbowrite__(sprintf("%s/xl/worksheets/sheet%d.xml",tmpdir,wsh_number), 
arrdat);
     for r=1:rows (arrdat)
       fprintf (fid, '<row r="%d" spans="%d:%d" x14ac:dyDescent="0.25">', ...
                r+lims(2, 1)-1, ...
@@ -391,8 +389,10 @@
           ## File exists => there are already some strings in the sheet
           shstr = fread (sid, "char=>char").';
           fclose (sid);
-          ## Extract string values. May be much more than present in current 
sheet
-          strings = cell2mat (regexp (shstr, 
'<si><t(?:.*?>(.*?)</t>|(.+?)/>)</si>', "tokens"));
+          ## Extract string values. May be much more than present in current 
sheet.
+          ## A two-step procedure is required to preserve empty strings 
("<t/>")
+          strings = cell2mat (regexp (shstr, '<si[^>]*>(.*?)</si>', "tokens"));
+          strings = regexprep (strings, '(^<t>|^<t/>|</t>$)', "");
           ## Watch out for a rare corner case: just one empty string... (avoid 
[])
           if (isempty (strings))
             strings = {""};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/io/inst/private/__OCT_xlsx2oct__.m 
new/io/inst/private/__OCT_xlsx2oct__.m
--- old/io/inst/private/__OCT_xlsx2oct__.m      2015-09-23 20:39:42.000000000 
+0200
+++ new/io/inst/private/__OCT_xlsx2oct__.m      2015-10-20 18:58:29.000000000 
+0200
@@ -175,16 +175,20 @@
     ## 3. Strings
     if (! isempty (strings))
       ## Extract string values. May be much more than present in current sheet
-                        strings=regexp(strings,'<si[^>]*>.*?</si>','match');
+                        strings = regexp (strings, '<si[^>]*>.*?</si>', 
"match");
                         for n = 1:columns(strings)
-                               
ctext{1,n}=cell2mat(cell2mat(regexp(strings{1,n},'<t[^>]*>(.*?)</t>','tokens')));
+                               ctext{1,n} = cell2mat (cell2mat (regexp 
(strings{1,n}, '<t[^>]*>(.*?)</t>', "tokens")));
                         end
       ## Pointers into sharedStrings.xml. "Hard" (fixed) strings have 't="s"' 
attribute
       ## For reasons known only to M$ those pointers are zero-based, so:
       vals = str2double (cell2mat (regexp (rawdata, '<c r="\w+"(?: s="\d+")? 
t="s"><v>(\d+)</v>', "tokens"))) + 1;
       if (! isempty (vals) && isfinite (vals))
-        ## Get actual values
+        ## Get actual values. Watch out for empty strings
         vals = ctext(vals);
+        ids = cellfun (@isempty, vals);
+        if (any (ids))
+          vals {find (ids)} = "";
+        endif
         ## Pretty text output
         vals = strrep (vals, "&quot;", '"');
         vals = strrep (vals, "&lt;", "<");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/io/inst/private/chknmrange.m 
new/io/inst/private/chknmrange.m
--- old/io/inst/private/chknmrange.m    1970-01-01 01:00:00.000000000 +0100
+++ new/io/inst/private/chknmrange.m    2015-10-03 00:18:33.000000000 +0200
@@ -0,0 +1,69 @@
+## Copyright (C) 2015 Philip Nienhuis
+## 
+## This program is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+## 
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+## 
+## You should have received a copy of the GNU General Public License
+## along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*- 
+## @deftypefn {Function File} [ @var{range}, @var{wsh}, @var{xls}] = chkrange 
(@var{xls}, @var{range}, @var{wsh})
+## Internal function. Checks if range is Named range & act accordingly
+##
+## @seealso{}
+## @end deftypefn
+
+## Author: Philip Nienhu01 <[email protected]>
+## Created: 2015-09-29
+
+function [datrange, wsh, xls] = chknmrange (xls, datrange, wsh)
+
+    mtch = cell2mat (regexp (datrange, ...
+                     '(^[A-Za-z]+[0-9]+){1}(:[A-Za-z]+[0-9]+$)?', "tokens"));
+    if (isempty (mtch) || ! strcmp ([mtch{:}], datrange))
+      ## Apparently not a range. Try range names
+      if (! isfield (xls, "nmranges"))
+        xls.nmranges = getnmranges (xls);
+      endif
+      idx = strmatch (datrange, xls.nmranges(:, 1));
+      if (isempty (idx))
+        error ("no range '%s' in workbook '%s'\n", datrange, xls.filename);
+      else
+        if (numel (idx) > 1)
+          ## Multiple sheets with same Named range
+          if (isnumeric (wsh))
+            ## No way to assess worksheet name here. Just take the first match
+            idx = idx(1);
+            printf ("multiple Range name matches for '%s', but no sheet *name* 
specified\n", ...
+                    datrange);
+            warning ("Data read from first match = sheet '%s'\n", 
xls.nmranges{idx, 2});
+          elseif (ischar (wsh))
+            jdx = strmatch (wsh, xls.nmranges(idx, 2));
+            if (isempty (jdx))
+              ## No match with specified wsh => just pick the first
+              idx = idx(1);
+              warning ("Named Range '%s' not defined in sheet '%s'\n         
Sheet '%s' taken\n", ...
+                       datrange, wsh, xls.nmranges{idx, 2});
+            else
+              idx = idx(jdx);
+            endif
+          else
+            error ("Illegal sheet name or index specified\n");
+          endif
+        endif
+        ## Get range and -optionally- sheet it refers to
+        datrange = xls.nmranges{idx, 3};
+        if (! isempty (xls.nmranges{idx, 2}))
+          wsh = xls.nmranges{idx, 2};
+        endif
+      endif
+    endif
+
+endfunction
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/io/inst/private/getodsinterfaces.m 
new/io/inst/private/getodsinterfaces.m
--- old/io/inst/private/getodsinterfaces.m      2015-09-23 20:19:13.000000000 
+0200
+++ new/io/inst/private/getodsinterfaces.m      2015-10-21 22:58:39.000000000 
+0200
@@ -71,6 +71,8 @@
       endif
     endif
   endif
+  ## deflt signals that some default interface has been selected. Just used
+  ## for cosmetic purposes
   deflt = 0;
 
   if (has_java)
@@ -202,8 +204,9 @@
   ## ---- Other interfaces here, similar to the ones above
 
   if (deflt)
-    printf ("(* = default interface)\n");
+    printf ("(* = default interface)");
   endif
+  printf ("\n");
 
   ## FIXME the below stanza should be dropped once UNO is stable.
   ## Echo a suitable warning about experimental status:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/io/inst/private/getxlsinterfaces.m 
new/io/inst/private/getxlsinterfaces.m
--- old/io/inst/private/getxlsinterfaces.m      2015-09-23 20:18:22.000000000 
+0200
+++ new/io/inst/private/getxlsinterfaces.m      2015-10-21 22:54:02.000000000 
+0200
@@ -77,6 +77,8 @@
       endif
     endif
   endif
+  ## deflt signals that some default interface has been selected. Just used
+  ## for cosmetic purposes
   deflt = 0;
 
   ## Check if MS-Excel COM ActiveX server runs (only on Windows!)
@@ -243,8 +245,9 @@
   ##      Java interfaces should be in the has-java if-block
 
   if (deflt)
-    printf ("(* = default interface)\n"); 
+    printf ("(* = default interface)");
   endif
+  printf ("\n");
 
   ## FIXME the below stanza should be dropped once UNO is stable.
   # Echo a suitable warning about experimental status:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/io/inst/xls2oct.m new/io/inst/xls2oct.m
--- old/io/inst/xls2oct.m       2015-09-23 22:01:59.000000000 +0200
+++ new/io/inst/xls2oct.m       2015-10-15 22:42:07.000000000 +0200
@@ -142,28 +142,10 @@
   ## Check range
   if (~(isempty (datrange) || ischar (datrange)))
     error ("Character string expected for arg # 3 (range)\n"); 
-  else
-    ## FIXME the following stanza can be made into a separate func
+  elseif (! isempty (datrange))
     ## Check for range name and convert it to range & optionally sheet
     ## 1. Check if it matches a range
-    mtch = cell2mat (regexp (datrange, ...
-                     '(^[A-Za-z]+[0-9]+){1}(:[A-Za-z]+[0-9]+$)?', "tokens"));
-    if (! isempty (mtch) && ! strcmp ([mtch{:}], datrange))
-      ## Apparently not a range. Try range names
-      if (! isfield (xls, "nmranges"))
-        xls.nmranges = getnmranges (xls);
-      endif
-      idx = strmatch (datrange, xls.nmranges(:, 1));
-      if (isempty (idx))
-        error ("oct2xls: no range '%s' in workbook", crange);
-      else
-        ## Get range and -optionally- sheet it refers to
-        datrange = xls.nmranges{idx, 3};
-        if (! isempty (xls.nmranges{idx, 2}))
-          wsh = xls.nmranges{idx, 2};
-        endif
-      endif
-    endif
+    [datrange, wsh, xls] = chknmrange (xls, datrange, wsh);
   endif
 
   ## Check & setup options struct
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/io/inst/xlsopen.m new/io/inst/xlsopen.m
--- old/io/inst/xlsopen.m       2015-09-23 20:13:18.000000000 +0200
+++ new/io/inst/xlsopen.m       2015-10-03 00:22:52.000000000 +0200
@@ -278,7 +278,7 @@
     [ xls, xlssupport, lastintf ] = __JXL_spsh_open__ (xls, xwrite, filename, 
xlssupport, ftype);
   endif
 
-  if ((! xlssupport) && xlsinterfaces.OXS && ftype <= 2)
+  if ((! xlssupport) && xlsinterfaces.OXS && ftype == 1)
     [ xls, xlssupport, lastintf ] = __OXS_spsh_open__ (xls, xwrite, filename, 
xlssupport, ftype);
   endif
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/io/inst/xlsread.m new/io/inst/xlsread.m
--- old/io/inst/xlsread.m       2015-09-23 22:01:27.000000000 +0200
+++ new/io/inst/xlsread.m       2015-10-06 19:55:24.000000000 +0200
@@ -70,6 +70,9 @@
 ## is numeric or a text string that does not contain a ":", it is
 ## assumed to be @var{wsh} and to refer to a worksheet.  In that case
 ## xlsread tries to read all data contained in that worksheet.
+## 
+## To be able to use Named ranges, the second input argument should
+## refer to a worksheet and the third should be the Named range.
 ##
 ## The optional last argument @var{reqintf} can be used to override 
 ## the automatic interface selection by xlsread out of the supported


Reply via email to