Mercurial > forge
changeset 12270:f99d0e2a6719 octave-forge
Warn that UNO will write ODS f. unsupported file extensions
author | prnienhuis |
---|---|
date | Wed, 01 Jan 2014 21:32:20 +0000 |
parents | 1071f03fc1aa |
children | b894e2fba4d6 |
files | main/io/inst/odsopen.m main/io/inst/xlsopen.m |
diffstat | 2 files changed, 21 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/main/io/inst/odsopen.m Wed Jan 01 21:31:25 2014 +0000 +++ b/main/io/inst/odsopen.m Wed Jan 01 21:32:20 2014 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2009,2010,2011,2012,2013 Philip Nienhuis <prnienhuis at users.sf.net> +## 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 @@ -74,7 +74,7 @@ ## ## @end deftypefn -## Author: Philip Nienhuis +## Author: Philip Nienhuis <prnienhuis at users.sf.net> ## Created: 2009-12-13 ## Updates: ## 2009-12-30 ....<forgot what is was > @@ -133,6 +133,8 @@ ## 2013-12-01 Updated texinfo header ## 2013-12-18 Style fixes ## 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 function [ ods ] = odsopen (filename, rw=0, reqinterface=[]) @@ -284,6 +286,10 @@ 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") + endif [ ods, odssupport, lastintf ] = ... __UNO_spsh_open__ (ods, rw, filename, odssupport); endif
--- a/main/io/inst/xlsopen.m Wed Jan 01 21:31:25 2014 +0000 +++ b/main/io/inst/xlsopen.m Wed Jan 01 21:32:20 2014 +0000 @@ -1,4 +1,4 @@ -## Copyright (C) 2009,2010,2011,2012,2013 Philip Nienhuis <prnienhuis at users.sf.net> +## Copyright (C) 2009,2010,2011,2012,2013 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 @@ -80,7 +80,7 @@ ## ## @end deftypefn -## Author: Philip Nienhuis +## Author: Philip Nienhuis <prnienhuis at users.sf.net> ## Created: 2009-11-29 ## Updates: ## 2010-01-03 Added OOXML support @@ -136,7 +136,10 @@ ## 2013-12-01 Add support for ODS (Excel 2007+ and OpenOffice.org/LibreOffice support it) ## 2013-12-27 Use one variable for processed file type ## '' Style fixes -## 2013-12-28 Allow OOXML support for OpenXLS +## 2013-12-28 Allow OOXML support for OpenXLS +## 2014-01-01 Add .csv to supported file extensions +## '' Add warning that UNO will write ODS f. unsupported file extensions +## '' Copyright string update function [ xls ] = xlsopen (filename, xwrite=0, reqinterface=[]) @@ -220,7 +223,7 @@ ## Check if Excel file exists. First check for (supported) file name suffix: ftype = 0; has_suffix = 1; - [sfxpos, ~, ~, ext] = regexpi (filename, '(\.xlsx?|\.gnumeric|\.ods)'); + [sfxpos, ~, ~, ext] = regexpi (filename, '(\.xlsx?|\.gnumeric|\.ods|\.csv)'); if (! isempty (sfxpos)) ext = lower (ext{end}); ## .xls or .xls[x,m,b] or .gnumeric is there, but at the right(most) position? @@ -241,6 +244,7 @@ case ".csv" ## csv. Detected for xlsread afficionados ftype = 6; otherwise + warning ("xlsopen: file type ('%s' extension) not supported", ext); endswitch endif else @@ -334,7 +338,11 @@ [ xls, xlssupport, lastintf ] = __OXS_spsh_open__ (xls, xwrite, filename, xlssupport, ftype); endif - if ((! xlssupport) && xlsinterfaces.UNO && (ftype != 5)) + if ((! xlssupport) && xlsinterfaces.UNO && (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") + endif [ xls, xlssupport, lastintf ] = __UNO_spsh_open__ (xls, xwrite, filename, xlssupport); endif