changeset 12326:220c88512673 octave-forge

Beta support for writing ODS with native OCT
author prnienhuis
date Wed, 22 Jan 2014 22:15:58 +0000
parents 430a677fd5b3
children e1ee77a6ddf5
files main/io/inst/oct2ods.m main/io/inst/odsopen.m
diffstat 2 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/main/io/inst/oct2ods.m	Wed Jan 22 18:38:31 2014 +0000
+++ b/main/io/inst/oct2ods.m	Wed Jan 22 22:15:58 2014 +0000
@@ -1,4 +1,4 @@
-## Copyright (C) 2009,2010,2011,2012,2013 Philip Nienhuis
+## Copyright (C) 2009,2010,2011,2012,2013,2014 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
@@ -201,10 +201,10 @@
     ## Write ods file tru Java & jOpenDocument. API still leaves lots to be wished...
     [ ods, rstatus ] = __JOD_oct2spsh__ (c_arr, ods, wsh, crange);
 
-  elseif (strcmp (ods.xtype, "UNO"))
-    ## Write ods file tru Java & UNO bridge (OpenOffice.org & clones)
-    [ ods, rstatus ] = __UNO_oct2spsh__ (c_arr, ods, wsh, crange, spsh_opts);
-
+  elseif (strcmp (ods.xtype, "OCT"))
+    ## Write ods file tru native Octave
+    [ ods, rstatus ] = __OCT_oct2ods__ (c_arr, ods, wsh, crange, spsh_opts);
+
   ##elseif 
     ##---- < Other interfaces here >
 
--- a/main/io/inst/odsopen.m	Wed Jan 22 18:38:31 2014 +0000
+++ b/main/io/inst/odsopen.m	Wed Jan 22 22:15:58 2014 +0000
@@ -135,6 +135,7 @@
 ## 2013-12-27 Use one variable for processed file types
 ## 2014-01-01 Add warning that UNO will write ODS f. unsupported file extensions
 ##     ''     Copyright string update
+## 2014-01-23 OCT ods write support for .ods
 
 function [ ods ] = odsopen (filename, rw=0, reqinterface=[])
 
@@ -207,8 +208,10 @@
   ## Var rw is really used to avoid creating files when wanting to read, or
   ## not finding not-yet-existing files when wanting to write a new one.
   ## Be sure it's either 0 or 1 initially
-  if (rw)
-    if (odsintf_cnt == 1 && odsinterfaces.OCT)
+  if (rw)
+    [~, ~, ext] = fileparts (filename);
+    ## .ods write support is supported
+    if (odsintf_cnt == 1 && odsinterfaces.OCT && ! strcmpi (ext, ".ods"))
       ## Check if OCT is only interface and writing is requested
       error ("OCT interface doesn't support writing files");
     endif