changeset 11635:d65d2076da4a octave-forge

Fix checks on xls or xls? suffix (due to Vermylen)
author prnienhuis
date Wed, 17 Apr 2013 19:32:29 +0000
parents 37d08939bb7b
children 11096f0cdd50
files main/io/inst/xlsopen.m main/io/inst/xlswrite.m
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/main/io/inst/xlsopen.m	Wed Apr 17 17:21:21 2013 +0000
+++ b/main/io/inst/xlsopen.m	Wed Apr 17 19:32:29 2013 +0000
@@ -123,6 +123,7 @@
 ## 2012-12-18 Improved warning/error messages
 ## 2012-03-01 Revamped logic for determining if file type is supported by a
 ##            particular interface
+## 2012-04-17 Fix checks on xls or xls? suffix (due to Vermylen)
 
 function [ xls ] = xlsopen (filename, xwrite=0, reqinterface=[])
 
@@ -228,8 +229,8 @@
   xlsinterfaces = getxlsinterfaces (xlsinterfaces);
 
   ## Supported interfaces determined; Excel file type check moved to separate interfaces.
-  chk1 = strcmpi (filename(end-3:end), '.xls');      ## Regular (binary) BIFF 
-  chk2 = strcmpi (filename(end-4:end-1), '.xls');    ## Zipped XML / OOXML
+  chk1 = strcmpi (filename(end-2:end), '.xls');      ## Regular (binary) BIFF 
+  chk2 = strcmpi (filename(end-3:end-1), '.xls');    ## Zipped XML / OOXML
   
   ## Initialize file ptr struct
   xls = struct ("xtype",    'NONE', 
--- a/main/io/inst/xlswrite.m	Wed Apr 17 17:21:21 2013 +0000
+++ b/main/io/inst/xlswrite.m	Wed Apr 17 19:32:29 2013 +0000
@@ -109,6 +109,7 @@
 ## 2012-06-07 Replaced all tabs by double space
 ## 2012-10-24 Style fixes
 ## 2012-12-23 Fix rare occasion of xlsclose error in unwind_protect block
+## 2012-04-17 Fix checks on xls or xls? suffix (due to Vermylen)
 
 function [ rstatus ] = xlswrite (filename, arr, arg3, arg4, arg5)
 
@@ -122,7 +123,7 @@
   elseif (nargin == 2)
     ## Assume first worksheet and full worksheet starting at A1
     wsh = 1;
-    if (strcmpi (filename(end-4:end-1), "xls"))
+    if (strcmpi (filename(end-3:end-1), "xls"))
       crange = "A1:XFD1048576";   ## OOXML has ridiculously large limits 
     else
       crange = "A1:IV65536";      ## Regular xls limits
@@ -132,7 +133,7 @@
     if (isnumeric (arg3) || (isempty (findstr (arg3, ":")) && ~isempty (arg3)))
       ## Apparently a worksheet specified
       wsh = arg3;
-      if (strcmpi (filename(end-4:end-1), "xls"))
+      if (strcmpi (filename(end-3:end-1), "xls"))
         crange = "A1:XFD1048576"; ## OOXML has ridiculously large limits 
       else
         crange = "A1:IV65536";    ## Regular xls limits