# HG changeset patch # User prnienhuis # Date 1390428958 0 # Node ID 220c885126734f9419baa49430bfa76bdcfe51c3 # Parent 430a677fd5b34cff98e1f4f4de4cdd6012fb2bd2 Beta support for writing ODS with native OCT diff -r 430a677fd5b3 -r 220c88512673 main/io/inst/oct2ods.m --- 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 > diff -r 430a677fd5b3 -r 220c88512673 main/io/inst/odsopen.m --- 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