From: <prn...@us...> - 2009-12-11 22:05:59
|
Revision: 6637 http://octave.svn.sourceforge.net/octave/?rev=6637&view=rev Author: prnienhuis Date: 2009-12-11 22:05:43 +0000 (Fri, 11 Dec 2009) Log Message: ----------- Commit of the new Excel xls r/w m-files. Added Paths: ----------- trunk/octave-forge/main/io/doc/ trunk/octave-forge/main/io/doc/READ-XLS.html trunk/octave-forge/main/io/inst/oct2com2xls.m trunk/octave-forge/main/io/inst/oct2jpoi2xls.m trunk/octave-forge/main/io/inst/oct2jxla2xls.m trunk/octave-forge/main/io/inst/oct2xls.m trunk/octave-forge/main/io/inst/parse_sp_range.m trunk/octave-forge/main/io/inst/parsecell.m trunk/octave-forge/main/io/inst/xls2com2oct.m trunk/octave-forge/main/io/inst/xls2jpoi2oct.m trunk/octave-forge/main/io/inst/xls2jxla2oct.m trunk/octave-forge/main/io/inst/xls2oct.m trunk/octave-forge/main/io/inst/xlsclose.m trunk/octave-forge/main/io/inst/xlsfinfo.m trunk/octave-forge/main/io/inst/xlsopen.m trunk/octave-forge/main/io/inst/xlsread_old.m trunk/octave-forge/main/io/inst/xlswrite.m Added: trunk/octave-forge/main/io/doc/READ-XLS.html =================================================================== --- trunk/octave-forge/main/io/doc/READ-XLS.html (rev 0) +++ trunk/octave-forge/main/io/doc/READ-XLS.html 2009-12-11 22:05:43 UTC (rev 6637) @@ -0,0 +1,301 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<HTML> +<HEAD> + <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252"> + <TITLE></TITLE> + <META NAME="GENERATOR" CONTENT="OpenOffice.org 3.0 (Win32)"> + <META NAME="AUTHOR" CONTENT="Philip Nienhuis"> + <META NAME="CREATED" CONTENT="20091211;17230700"> + <META NAME="CHANGEDBY" CONTENT="Philip Nienhuis"> + <META NAME="CHANGED" CONTENT="20091211;22461600"> + <META NAME="Info 1" CONTENT=""> + <META NAME="Info 2" CONTENT=""> + <META NAME="Info 3" CONTENT=""> + <META NAME="Info 4" CONTENT=""> + <STYLE TYPE="text/css"> + <!-- + @page { margin: 0.79in } + P { margin-bottom: 0.08in } + A:link { so-language: zxx } + --> + </STYLE> +</HEAD> +<BODY LANG="en-US" DIR="LTR"> +<P ALIGN=CENTER STYLE="margin-bottom: 0in">README for Excel +spreadsheet file r/w access scripts for octave (> +3.2.0)<BR><BR>Copyright (C) 2009, Philip Nienhuis <prnienhuis at +users.sf.net><BR><BR>This version 11 December 2009.</P> +<P ALIGN=CENTER STYLE="margin-bottom: 0in"><BR> +</P> +<P ALIGN=LEFT STYLE="margin-bottom: 0in"><BR> +</P> +<P ALIGN=CENTER STYLE="margin-bottom: 0in"><FONT SIZE=4 STYLE="font-size: 15pt"><U><B>EXCEL + .XLS SUPPORT FILES</B></U></FONT></P> +<P ALIGN=LEFT STYLE="margin-bottom: 0in"><BR><B>doc/README-XLS.html</B></P> +<P ALIGN=LEFT STYLE="margin-bottom: 0in">This file.</P> +<P ALIGN=CENTER STYLE="margin-bottom: 0in"><I>----- Functions +intended for direct invocation by users ------</I></P> +<P ALIGN=LEFT STYLE="margin-bottom: 0in"><BR><B>xlsread.m</B></P> +<P STYLE="margin-bottom: 0in">All-in-one function for reading data +from one specific worksheet in an Excel spreadsheet file. This script +has Matlab-compatible functionality.<BR><BR><B>xlswrite.m</B></P> +<P STYLE="margin-bottom: 0in">All-in-one function for writing data to +one specific worksheet in an Excel spreadsheet file. This script has +Matlab-compatible functionality. <BR><BR><B>xlsfinfo.m</B></P> +<P STYLE="margin-bottom: 0in">All-in-one function for exploring basic +properties of an Excel spreadsheet file. This script has +Matlab-compatible functionality.<BR><BR><B>xlsopen.m</B></P> +<P STYLE="margin-bottom: 0in">Function for "opening" (= +providing a handle to) an Excel spreadsheet file ("workbook"). +This function sorts out which interface to use for .xls access +(i.e.,COM; Java & Apache POI; JexcelAPI; etc.), but it's choice +can be overridden.<BR><BR><B>xls2oct.m</B></P> +<P STYLE="margin-bottom: 0in">Function for reading data from a +specific worksheet pointed to in a struct created by xlsopen.m. +xls2oct can be called multiple times consecutively using the same +pointer struct, each time allowing to read data from different ranges +and/or worksheets. Data are returned in the form of a 2D +heterogeneous cell array that can be parsed by parsecell.m. xls2oct +is a mere wrapper for interface-dependent scripts that do the actual +low-level reading .<BR><BR><B>oct2xls.m</B></P> +<P STYLE="margin-bottom: 0in">Function for writing data to a specific +worksheet pointed to in a struct created by xlsopen.m. octxls can be +called multiple times consecutively using the same pointer struct, +each time allowing to write data to different ranges and/or +worksheets. oct2xls is a mere wrapper for interface-dependent scripts +that do the actual low-level writing.<BR><BR><B>xlsclose.m</B></P> +<P STYLE="margin-bottom: 0in">Function for closing (the handle to) an +Excel workbook. When data have been written to the workbook oct2xls +will write the workbook to disk. Otherwise, the file pointer is +simply closed and possibly used interfaces for Excel access +(COM/ActiveX/Excel.exe) will be shut down properly.<BR><BR><B>parsecell.m</B></P> +<P STYLE="margin-bottom: 0in">Function for separating the data in raw +arrays returned by xls2oct, into numerical/logical and text (cell) +arrays.</P> +<P ALIGN=CENTER STYLE="margin-bottom: 0in"><BR><I>------- Lower level +function for indirect use --------<BR>(though there's no problem in +calling them directly)</I></P> +<P STYLE="margin-bottom: 0in"><BR><B>xls2com2oct.m, oct2com2xls.m</B></P> +<P STYLE="margin-bottom: 0in">Functions for carrying out the actual +reading from and writing to an Excel file using the COM interface on +Windows systems where Excel has been installed. In fact, Excel.exe is +invoked directly but invisibly. These low-level functions are not +intended for direct use, they should rather be invoked through +xls2oct() and oct2xls(). In principle all Excel file types can be +processed providing the installed Excel version supports those +formats. But for now only .xls is supported.<BR><BR><B>xls2jpoi2oct.m, +oct2jpoi2xls.m</B></P> +<P STYLE="margin-bottom: 0in">Functions for reading from and writing +to an Excel file using the Java & Apache POI interface on any +system where Java > 1.6.0 has been installed. These low-level +functions are not meant to be invoked directly by users but rather +through the xls2oct() and oct2xls() functions. Only Excel 97-2003 +files (BIFF8 format) and (to be implemented later:) OOXML spreadsheet +files can be read from and written to.<BR><BR><B>xls2jxla2com.m, +oct2jxla2com.m</B></P> +<P STYLE="margin-bottom: 0in">Functions for reading from and writing +to an Excel file using the Java & JExcelAPI interface on any +system where Java > 1.6.0 is installed. These low-level functions +aren't meant to be invoked directly by users but rather through the +xls2oct() & oct2xls() functions. Excel 95 (BIFF 5; reading only) +and Excel 97-2003 (BIFF8; reading & writing) formats are +supported.</P> +<P STYLE="margin-bottom: 0in"><BR> +</P> +<P ALIGN=CENTER STYLE="margin-bottom: 0in"><BR><FONT SIZE=4 STYLE="font-size: 15pt"><U><B>REQUIRED +SUPPORT SOFTWARE</B></U></FONT></P> +<P STYLE="margin-bottom: 0in"><BR>For the Excel/COM interface:</P> +<UL> + <LI><P STYLE="margin-bottom: 0in">A windows computer with Excel + installed</P> + <LI><P STYLE="margin-bottom: 0in">Octave-forge Windows-1.0.8 package + WITH LATEST SVN PATCHES APPLIED</P> +</UL> +<P STYLE="margin-left: 0.25in; text-indent: -0.26in; margin-bottom: 0in"> +<BR> +</P> +<P STYLE="margin-left: 0.25in; text-indent: -0.26in; margin-bottom: 0in"> +For the Java / Apache POI / JExcelAPI interfaces (general):</P> +<UL> + <LI><P STYLE="margin-bottom: 0in">octave-forge java-1.2.5 package or + later version on Linux</P> + <LI><P STYLE="margin-bottom: 0in">octave-forge java-1.2.6 with + latest svn fixes on Windows/MingW</P> + <LI><P STYLE="margin-bottom: 0in">Java jre or jdk > 1.6.0 (hasn't + been tested with earlier versions)</P> + <LI><P STYLE="margin-bottom: 0in">./jre/lib/rt.jar in classpath</P> +</UL> +<P STYLE="margin-bottom: 0in">Apache POI specific:</P> +<UL> + <LI><P STYLE="margin-bottom: 0in">class .jars: + <B>poi-3.5-FINAL-<date>.jar</B> & + <B>poi-ooxml-3.5-FINAL-<date>.jar</B> (or later versions) in + classpath</P> + <LI><P STYLE="margin-bottom: 0in">Get it here: + <A HREF="http://poi.apache.org/download.html">http://poi.apache.org/download.html</A></P> +</UL> +<P STYLE="margin-bottom: 0in">JExcelAPI specific:</P> +<UL> + <LI><P STYLE="margin-bottom: 0in">class .jar: <B>jxl.jar</B> in + classpath</P> + <LI><P STYLE="margin-bottom: 0in">Get it here: + <A HREF="http://sourceforge.net/projects/jexcelapi/files/">http://sourceforge.net/projects/jexcelapi/files/</A></P> +</UL> +<P STYLE="margin-bottom: 0in">Hint: simply put the relevant +javaaddpath statements in the .octaverc file.</P> +<P ALIGN=CENTER STYLE="margin-bottom: 0in"><BR> +</P> +<P ALIGN=CENTER STYLE="margin-bottom: 0in"><BR><FONT SIZE=4 STYLE="font-size: 15pt"><U><B>USAGE</B></U></FONT></P> +<P STYLE="margin-bottom: 0in"><BR><B>xlsread</B> and <B>xlswrite</B> +are mere wrappers for <B>xlsopen</B>-<B>xls2oct</B>-<B>xlsclose</B>-<B>parsecell</B> +and <B>xlsopen</B>-<B>oct2xls</B>-<B>xlsclose</B> sequences, resp. +They exist for the sake of Matlab compatibility.<BR><BR><B>xlsfinf</B>o +can be used for finding out what worksheet names exist in the +file.<BR><BR>Invoking <B>xlsopen</B>/..../<B>xlsclose</B> directly +provides for much more flexibility, speed, and robustness than +<B>xlsread</B> / <B>xlswrite</B>. Indeed, using the same file handle +(pointer struct) you can mix reading & writing before writing the +workbook out to disk using xlsclose.<BR>And: <B>xlsopen </B>/ +<B>xlsclose</B> hide the gory interface details from the +user.<BR>Currently only .xls files (BIFF8) can be read/written; using +JExcelAPI BIFF5 can be read as well.<BR><BR>When using +<B>xlsopen</B>....<B>xlsclose</B> be sure to keep track of the file +handle struct.<BR><BR>A possible scenario:<BR><BR><B>xlh = xlsopen +(<excel_filename> , [rw], [<requested interface>])</B><BR><I># +Set rw to 1 if you want to write to a workbook immediately.<BR># In +that case the check for file existence is skipped and<BR># -if +needed- a new workbook created.<BR># If you really want an other +interface than auto-selected<BR># by xlsopen you can request that. +But xlsopen still checks<BR># proper support for your choice.</I><BR><BR><I># +Read some data</I><BR><B>[ rawarr1, xlh ] = xls2oct (xlh, +<SomeWorksheet>, <Range>)</B><BR><I># Be sure to specify +xlh as output argument as xls2oct keeps<BR># track of changes and the +need to write the workbook to disk <BR># in the xlhstruct. And the +origin range is conveyed through<BR># the xlh pointer struct.</I><BR><BR><I># +Separate data into numeric and text data</I><BR><B>[ numarr1, +txtarr1, lim1 ] = parsecell (rawarr1)</B><BR><I><BR></I># Get more +data from another worksheet in the same workbook<BR><B>[ rawarr2, xlh +] = xls2oct (xlh, <SomeOtherWorksheet>, <Range>)</B><BR><B>[ +numarr2, txtarr2, lim2 ] = parsecell (rawarr2)</B><BR><BR># <... +Analysis and preparation of new data in cell array Newdata....><BR><BR><I># +Add new data to spreadsheet</I><BR><B>xlh = oct2xls (Newdata, xlh, +<AnotherWorksheet>, <Range>)</B><BR><BR><I># Close the +workbook and write it to disk; then clear the handle</I><BR><B>xlh = +xlsclose (xlh)</B><BR><B>clear xlh</B></P> +<P STYLE="margin-bottom: 0in"><BR> +</P> +<P ALIGN=CENTER STYLE="margin-bottom: 0in"><FONT SIZE=4 STYLE="font-size: 15pt"><U><B>MATLAB +COMPATIBILITY</B></U></FONT></P> +<P STYLE="margin-bottom: 0in"><BR><B>xlsread</B>, <B>xlswrite</B> and +<B>xlsfinfo</B> are for the most part matlab-compatible. Some small +differences are mentioned below.<BR><BR><B>xlsread</B><BR>Matlab's +<B>xlsread</B> supports invoking extra functions while reading +("passing function handle"); octave not. But this can be +simulated outside <B>xlsread</B>.<BR><BR>Matlab's <B>xlsread</B> +flags some spreadsheet errors, octave-forge just returns blank +cells.<BR><BR>When using a Java interface, octave-forge returns info +about the actual (rather than the requested) cell range where the +data came from; matlab can't. This is due to Excel automatically +trimming returned arrays from empty outer columns and rows; when +using COM, octave has the same limitation.<BR>Personally I find it +very useful to know from what part of a worksheet the data originate +so I've put quite some effort in it :-)<BR><BR>When using the Java +interface, reading and writing xls-files by octave-forge is +platform-independent. On systems w/o Excel Matlab can only read Excel +95 formatted .xls files.<BR><BR>Matlab's <B>xlsread</B> invokes +<B>csvread</B> if no Excel interface is present. Octave-forge's +<B>xlsread</B> doesn't.<BR><BR><B>xlswrite</B><BR>Octave-forge's +<B>xlswrite</B> works on systems w/o Excel support, matlab's +doesn't.<BR><BR><B>xlsfinfo</B><BR>When invoking Excel/COM interface, +octave-forge's <B>xlsfinfo</B> also echoes the type of sheet +(worksheet, chart), not just the sheet names. Using Java I haven't +found similar functionality (yet).</P> +<P STYLE="margin-bottom: 0in"><BR> +</P> +<P STYLE="margin-bottom: 0in"><BR> +</P> +<P ALIGN=CENTER STYLE="margin-bottom: 0in"><FONT SIZE=4 STYLE="font-size: 15pt"><U><B>COMPARISON +OF INTERFACES & USAGE</B></U></FONT></P> +<P STYLE="margin-bottom: 0in"><BR> +</P> +<P STYLE="margin-bottom: 0in">Using Excel itself (through COM / +ActiveX on Windows systems) is probably the most robust and versatile +option. There's one gotcha: in case of some type of COM errors Excel +will keep running invisibly, you can only end it through Task +Manager.<BR>A tiny problem is that one cannot find out easily through +COM what file types are supported; xls, wks, wk1, xlsx, etc.<BR>Another +-obvious- limitation is that COM Excel access only works on Windows +systems where Excel is installed.<BR>As Excel/COM trims returned +arrays from empty outer row and columns it is not easy to find out +from what cell range the returned data originate.<BR><BR>JExcelAPI +(Java-based and therefore platform-independent) is proven technology +but switching between reading and writing is quite involved and +memory-hungry when processing large spreadsheets. As the docs state, +JExcelAPI is optimized for reading and it does do that well - but +slower than Excel/COM. The fact that upon a switch from reading to +writing the existing spreadsheet is overwritten in place by a blank +one and that you can only get the contents back wen writing out all +of the changes is worrying - and any change after the first write() +is lost as a next write() doesn't seem to work. The first is by +JExcelAPI design, the second is probably a bug (in octave-forge/Java +or JExcelAPI ? I don't know). Adding data to existing spreadsheets +does work, but IMO undue confidence is needed.</P> +<P STYLE="margin-bottom: 0in">JExcelAPI supports BIFF5 and BIFF8 +(Excel 95 and Excel 97-2003, respectively).<BR><BR>Apache POI +(Java-based and platform-independent too) is based on the +OpenOffice.org I/O Excel r/w routines. It is a little more versatile +than JExcelAPI, however it while it doesn't support BIFF5 it does +support BIFF8 and OOXML (Excel 2007). It is almost as fast as native +Excel & COM, but at the moment (3.5-FINAL) evaluation of complex +Excel formulas while reading .xls files seems broken and OOXML +support is not working yet through octave.<BR><BR>All in all, of the +two Java options I'd lightly prefer JExcelAPI but I hope that Apache +POI gets better soon.</P> +<P STYLE="margin-bottom: 0in"><BR> +</P> +<P STYLE="margin-bottom: 0in"><BR> +</P> +<P ALIGN=CENTER STYLE="margin-bottom: 0in"><FONT SIZE=4 STYLE="font-size: 15pt"><U><B>DEVELOPMENT</B></U></FONT></P> +<P ALIGN=CENTER STYLE="margin-bottom: 0in"><BR> +</P> +<P STYLE="margin-bottom: 0in"><B>xlsopen</B>/<B>xlsclos</B>e and +friends have been written so that adding other interfaces (Perl? +...?) should be very easily accomplished. <B>xlsopen</B> merely needs +two stanzas, <B>xls2oct</B>, <B>oct2xls</B> and <B>xlsfinfo</B> each +need an additional elseif clause, and <B>xlsclose</B> needs a small +stanza for closing the pointer struct and writing to disk. +</P> +<P STYLE="margin-bottom: 0in">The real work lies in creating the +relevant <B>xls2<...>2oct</B> & <B>oct2<...>2xls</B> +scripts, but that shouldn't be really hard. Separating the file +access functions and the actual reading/writing from/to the workbook +in memory has made developer's life (I mean: my time developing this +stuff) much easier.<BR><BR>Some other options for development (who?):</P> +<UL> + <LI><P STYLE="margin-bottom: 0in">Speeding up, especially Java + worksheet/cell access. For cracks, not me.</P> + <LI><P STYLE="margin-bottom: 0in">Automatic conversion of Excel + date/time values into octave ones and vice versa. But then again + Excel's dates are 01-01-1900 based (octave's 0-0-0000) and buggy + (Excel thinks 1900 is a leap year), and I sometimes have to use + dates from before 1900. Maybe as an option?</P> + <LI><P STYLE="margin-bottom: 0in">Creating Excel graphs (a + significant enterprise to write from scratch).</P> + <LI><P STYLE="margin-bottom: 0in">ODS (OpenOffice.org Open Document) + support. Probably to be called odsread.m / odswrite.m. This is on my + own wish list.</P> + <LI><P STYLE="margin-bottom: 0in">Support for "passing function + handle" in xlsread.</P> +</UL> +<P STYLE="margin-left: 0.26in; text-indent: -0.26in; margin-bottom: 0in"> +<BR> +</P> +<P STYLE="margin-left: 0.26in; text-indent: -0.26in; margin-bottom: 0in"> +Enjoy!</P> +<P STYLE="margin-left: 0.26in; text-indent: -0.26in; margin-bottom: 0in"> +<BR> +</P> +<P ALIGN=CENTER STYLE="margin-left: 0.26in; text-indent: -0.26in; margin-bottom: 0in"> +Philip Nienhuis, Dec 10, 2009</P> +</BODY> +</HTML> \ No newline at end of file Added: trunk/octave-forge/main/io/inst/oct2com2xls.m =================================================================== --- trunk/octave-forge/main/io/inst/oct2com2xls.m (rev 0) +++ trunk/octave-forge/main/io/inst/oct2com2xls.m 2009-12-11 22:05:43 UTC (rev 6637) @@ -0,0 +1,202 @@ +## Copyright (C) 2007 by Michael Goffioul <michael.goffioul at swing.be> +## +## Adapted by P.R. Nienhuis <prnienhuis at users.sf.net> (2009) +## for more flexible writing into Excel worksheets through COM. +## +## 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 2 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{xlso}, @var{status}] = oct2com2xls (@var{obj}, @var{xlsi}) +## @deftypefnx {Function File} [@var{xlso}, @var{status}] = oct2com2xls (@var{obj}, @var{xlsi}, @var{wsh}) +## @deftypefnx {Function File} [@var{xlso}, @var{status}] = oct2com2xls (@var{obj}, @var{xlsi}, @var{wsh}, @var{top_left_cell}) +## Save matrix @var{obj} into worksheet @var{wsh} in Excel file pointed +## to in struct @var{xlsi}. All elements of @var{obj} are converted into +## Excel cells, starting at cell @var{top_left_cell}. Return argument +## @var{xlso} is @var{xlsi} with updated fields. +## +## oct2com2xls should not be invoked directly but rather through oct2xls. +## +## Excel invocations may be left running invisibly in case of COM errors. +## +## Example: +## +## @example +## xls = oct2com2xls (rand (10, 15), xls, 'Third_sheet', 'BF24'); +## @end example +## +## @seealso oct2xls, xls2oct, xlsopen, xlsclose, xlswrite, xlsread, xls2com2oct +## +## @end deftypefn + +## Author: Philip Nienhuis +## Rewritten: 2009-09-26 +## Last updated 2009-12-11 + +function [ xls, status ] = oct2com2xls (obj, xls, wsh, top_left_cell='A1') + + # define some constants not yet in __COM__.cc + xlWorksheet = -4167; # xlChart= 4; + + # scratch vars + status = 0; + + # Preliminary sanity checks + if (nargin < 2) error ("oct2com2xls needs a minimum of 2 arguments."); endif + if (nargin == 2) wsh = 1; endif + if (~iscell (obj)) error ("Cell array expected as input argument"); endif + if (~strcmp (tolower (xls.filename(end-3:end)), '.xls')) + error ("oct2com2xls can only write to Excel .xls files") + endif + if (isnumeric (wsh)) + if (wsh < 1) error ("Illegal worksheet number: %i\n", wsh); endif + elseif (size (wsh, 2) > 31) + error ("Illegal worksheet name - too long") + endif + if (isempty (obj)) + warning ("Request to write empty matrix."); + rstatus = 1; + return; + endif + test1 = ~isfield (xls, "xtype"); + test1 = test1 || ~isfield (xls, "workbook"); + test1 = test1 || ~strcmp (char (xls.xtype), 'COM'); + test1 = test1 || isempty (xls.workbook); + test1 = test1 || isempty (xls.app); + if test1 + error ("Invalid file pointer struct"); + endif + + # Cleanup NaNs. Start with backing up strings, empty & boolean cells, + # then set text cells to 0 + obj2 = cell (size (obj)); + txtptr = cellfun ('isclass', obj, 'char'); + if (any(txtptr)) obj2{txtptr} = obj{txtptr}; obj{txtptr} = 0; endif + eptr = cellfun ('isempty', obj); + if (any (eptr)) obj{eptr} = 0; endif + lptr = cellfun ("islogical" , obj); + if (any (lptr)) obj2{lptr} = obj{lptr}; obj{lptr} = 0; endif + + ptr = cellfun ("isnan", obj); + if (any (ptr)) obj{ptr} = []; endif + + # Restore text & booleans + if (any (txtptr)) obj{txtptr} = obj2{txtptr}; endif + if (any (lptr)) obj{lptr} = obj2{lptr}; endif + clear obj2 txtptr eptr lptr ptr; + + if (xls.changed < 2) + # Existing file. Some involved investigation is needed to preserve + # existing data that shouldn't be touched. + # + # See if desired *sheet* name exists. + old_sh = 0; + ws_cnt = xls.workbook.Sheets.count; + if (isnumeric (wsh)) + if (wsh <= ws_cnt) + # Here we check for sheet *position* in the sheet stack + # rather than a name like "Sheet<Number>" + old_sh = wsh; + else + # wsh > nr of sheets; proposed new sheet name. + # This sheet name can already exist to the left in the sheet stack! + shnm = sprintf ("Sheet%d", wsh); shnm1 = shnm; + endif + endif + if (~old_sh) + # Check if the requested (or proposed) sheet already exists + # COM objects are not OO (yet?), so we need a WHILE loop + ii = 1; jj = 1; + while ((ii <= ws_cnt) && ~old_sh) + # Get existing sheet names one by one + sh_name = xls.workbook.Sheets(ii).name; + if (~isnumeric (wsh) && strcmp (sh_name, wsh)) + # ...and check with requested sheet *name*... + old_sh = ii; + elseif (isnumeric (wsh) && strcmp (sh_name, shnm)) + # ... or proposed new sheet name (corresp. to requested sheet *number*) + shnm = [shnm "_"]; + ii = 0; # Also check if this new augmented sheet name exists... + if (strmatch (shnm1, sh_name)), jj++; endif + if (jj > 5) # ... but not unlimited times... + error (sprintf (" > 5 sheets named [_]Sheet%d already present!", wsh)); + endif + endif + ++ii; + endwhile + endif + + if (old_sh) + # Requested sheet exists. Check if it is a *work*sheet + if ~(xls.workbook.Sheets(old_sh).Type == xlWorksheet) + # Error as you can't write data to this + error (sprintf ("Existing sheet '%s' is not type worksheet.", wsh)); + else + # Simply point to the relevant sheet + sh = xls.workbook.Worksheets (old_sh); + endif + else + # Add a new worksheet. Earlier it was checked whether this is safe + sh = xls.workbook.Worksheets.Add (); + if (~isnumeric (wsh)) + sh.Name = wsh; + else + sh.Name = shnm; + printf ("Writing to worksheet %s\n", shnm); + endif + # Prepare to move new sheet to right of the worksheet stack anyway + ws_cnt = xls.workbook.Worksheets.count; # New count needed + # Find where Excel has left it. We have to, depends on Excel version :-( + ii = 1; + while ((ii < ws_cnt+1) && ~strcmp (sh.Name, xls.workbook.Worksheets(ii).Name) == 1) + ++ii; + endwhile + # Excel can't move it beyond the current last one, so we need a trick. + # First move it to just before the last one.... + xls.workbook.Worksheets(ii).Move (before = xls.workbook.Worksheets(ws_cnt)); + # ....then move the last one before the new sheet. + xls.workbook.Worksheets (ws_cnt).Move (before = xls.workbook.Worksheets(ws_cnt - 1)); + endif + xls.changed = 1; + + else + # The easy case: a new Excel file. + # Workbook was created in xlsopen. Write to first worksheet: + sh = xls.workbook.Worksheets (1); + # Delete empty non-used sheets, last one first + xls.app.Application.DisplayAlerts = 0; + xls.workbook.Worksheets(3).Delete(); xls.workbook.Worksheets(2).Delete(); + xls.app.Application.DisplayAlerts = 1; + + # Rename the sheet + if (isnumeric(wsh)) + sh.Name = sprintf("Sheet%i", wsh); + else + sh.Name = wsh; + endif + xls.changed = 2; + endif + + # MG's original part. + # Save object in Excel sheet, starting at cell top_left_cell + if (~isempty(obj)) + r = sh.Range (top_left_cell); + r = r.Resize (size (obj, 1), size (obj, 2)); + r.Value = obj; + delete (r); + endif + + # If we get here, all went OK + status = 1; + +endfunction \ No newline at end of file Added: trunk/octave-forge/main/io/inst/oct2jpoi2xls.m =================================================================== --- trunk/octave-forge/main/io/inst/oct2jpoi2xls.m (rev 0) +++ trunk/octave-forge/main/io/inst/oct2jpoi2xls.m 2009-12-11 22:05:43 UTC (rev 6637) @@ -0,0 +1,159 @@ +## Copyright (C) 2009 Philip Nienhuis <prnienhuis at users.sf.net> +## +## 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 2 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 Octave; see the file COPYING. If not, see +## <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} [ @var{xlso}, @var{rstatus} ] = oct2jpoi2xls ( @var{arr}, @var{xlsi}) +## @deftypefnx {Function File} [ @var{xlso}, @var{rstatus} ] = oct2jpoi2xls (@var{arr}, @var{xlsi}, @var{wsh}) +## @deftypefnx {Function File} [ @var{xlso}, @var{rstatus} ] = oct2jpoi2xls (@var{arr}, @var{xlsi}, @var{wsh}, @var{topleft}) +## +## Add data in 1D/2D CELL array @var{arr} into a range with upper left +## cell equal to @var{topleft} in worksheet @var{wsh} in an Excel +## spreadsheet file pointed to in structure @var{range}. +## Return argument @var{xlso} equals supplied argument @var{xlsi} and is +## updated by oct2java2xls. +## +## oct2jpoi2xls should not be invoked directly but rather through oct2xls. +## +## Example: +## +## @example +## [xlso, status] = xls2jpoi2oct ('arr', xlsi, 'Third_sheet', 'AA31'); +## @end example +## +## @seealso oct2xls, xls2oct, xlsopen, xlsclose, xlsread, xlswrite +## +## @end deftypefn + +## Author: Philip Nienhuis +## Created: 2009-11-26 +## Last updated 2009-12-11 + +function [ xls, rstatus ] = oct2jpoi2xls (obj, xls, wsh, topleftcell="A1") + + persistent ctype; + if (isempty (ctype)) + # Get cell types. Beware as they start at 0 not 1 + ctype(1) = java_get ('org.apache.poi.ss.usermodel.Cell', 'CELL_TYPE_NUMERIC'); + ctype(2) = java_get ('org.apache.poi.ss.usermodel.Cell', 'CELL_TYPE_STRING'); + ctype(3) = java_get ('org.apache.poi.ss.usermodel.Cell', 'CELL_TYPE_FORMULA'); + ctype(4) = java_get ('org.apache.poi.ss.usermodel.Cell', 'CELL_TYPE_BLANK'); + ctype(5) = java_get ('org.apache.poi.ss.usermodel.Cell', 'CELL_TYPE_BOOLEAN'); + ctype(6) = java_get ('org.apache.poi.ss.usermodel.Cell', 'CELL_TYPE_ERROR'); + endif + + # scratch vars + rstatus = 0; changed = 1; + + # Preliminary sanity checks + if (isempty (obj)) + warning ("Request to write empty matrix."); + rstatus = 1; + return; + elseif (~iscell(obj)) + error ("First argument is not a cell array"); + endif + if (nargin < 2) error ("oct2jpoi2xls needs a minimum of 2 arguments."); endif + if (nargin == 2) wsh = 1; endif + if (~strmatch(tolower(xls.filename(end-4:end)), '.xls')) + error ("oct2jpoi2xls can only write to Excel .xls or .xlsx files") + endif + # Check if xls struct pointer seems valid + test1 = ~isfield (xls, "xtype"); + test1 = test1 || ~isfield (xls, "workbook"); + test1 = test1 || ~strcmp (char (xls.xtype), 'POI'); + test1 = test1 || isempty (xls.workbook); + test1 = test1 || isempty (xls.app); + if test1 error ("Invalid xls file struct"); endif + + # Check if requested worksheet exists in the file & if so, get pointer + nr_of_sheets = xls.workbook.getNumberOfSheets(); + if (isnumeric (wsh)) + if (wsh > nr_of_sheets) + # Watch out as a sheet called Sheet%d can exist with a lower index... + strng = sprintf ("Sheet%d", wsh); + ii = 1; + while (~isempty (xls.workbook.getSheet (strng)) && (ii < 5)) + strng = ['_' strng]; + ++ii; + endwhile + if (ii >= 5) error (sprintf( " > 5 sheets named [_]Sheet%d already present!", wsh)); endif + sh = xls.workbook.createSheet (strng); + else + sh = xls.workbook.getSheetAt (wsh - 1); # POI sheet count 0-based + endif + printf ("(Writing to worksheet %s)\n", sh.getSheetName()); + else + sh = xls.workbook.getSheet (wsh); + if (isempty(sh)) + # Sheet not found, just create it + sh = xls.workbook.createSheet (wsh); + xls.changed = 2; + endif + endif + + # Beware of strings variables interpreted as char arrays; change them to cell. + if (ischar (obj)) obj = {obj}; endif + + [topleft, nrows, ncols, trow, lcol] = parse_sp_range (topleftcell); + [nrows, ncols] = size (obj); + + # Prepare type array + typearr = ctype(4) * ones (nrows, ncols); # type "BLANK", provisionally + obj2 = cell (size (obj)); # Temporary storage for strings + + txtptr = cellfun ('isclass', obj, 'char'); # type "STRING" replaced by "NUMERIC" + obj2(txtptr) = obj(txtptr); obj(txtptr) = ctype(1); # Save strings in a safe place + + emptr = cellfun ("isempty", obj); + obj(emptr) = ctype(1); # Set empty cells to NUMERIC + + lptr = cellfun ("islogical" , obj); # Find logicals... + obj2(lptr) = obj(lptr); # .. and set them to BOOLEAN + + ptr = cellfun ("isnan", obj); # Find NaNs & set to BLANK + typearr(ptr) = ctype(4); typearr(~ptr) = ctype(1); # All other cells are now numeric + + obj(txtptr) = obj2(txtptr); # Copy strings back into place + obj(lptr) = obj2(lptr); + typearr(txtptr) = ctype(2); # ...and clean up + typearr(emptr) = ctype(4); + typearr(lptr) = ctype(5); # BOOLEAN + + # Create formula evaluator (needed to be able to write boolean values!) + frm_eval = xls.workbook.getCreationHelper().createFormulaEvaluator(); + + for ii=1:nrows + ll = ii + trow - 2; # Java POI's row count = 0-based + row = sh.getRow (ll); + if (isempty (row)) row = sh.createRow (ll); endif + for jj=1:ncols + kk = jj + lcol - 2; # POI's column count is also 0-based + cell = row.createCell (kk, typearr(ii,jj)); + if (typearr(ii, jj) == ctype(5)) + cell = row.createCell (kk, ctype(3)); + # Provisionally we make do with formulas evaluated immediately 8-Z + if obj{ii, jj} bool = '(1=1)'; else bool = '(1=0)'; endif + cell.setCellFormula (bool); frm_eval.evaluateInCell (cell); + elseif ~(typearr(ii, jj) == 3) + # Just put text or number in cell + cell.setCellValue (obj{ii, jj}); + endif + endfor + endfor + + rstatus = 1; + +endfunction Added: trunk/octave-forge/main/io/inst/oct2jxla2xls.m =================================================================== --- trunk/octave-forge/main/io/inst/oct2jxla2xls.m (rev 0) +++ trunk/octave-forge/main/io/inst/oct2jxla2xls.m 2009-12-11 22:05:43 UTC (rev 6637) @@ -0,0 +1,159 @@ +## Copyright (C) 2009 Philip Nienhuis <prnienhuis at users.sf.net> +## +## 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 2 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 Octave; see the file COPYING. If not, see +## <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} [ @var{xlso}, @var{rstatus} ] = oct2jxla2xls ( @var{arr}, @var{xlsi}) +## @deftypefnx {Function File} [ @var{xlso}, @var{rstatus} ] = oct2jxla2xls (@var{arr}, @var{xlsi}, @var{wsh}) +## @deftypefnx {Function File} [ @var{xlso}, @var{rstatus} ] = oct2jxla2xls (@var{arr}, @var{xlsi}, @var{wsh}, @var{topleft}) +## +## Add data in 1D/2D CELL array @var{arr} into a range with upper left +## cell equal to @var{topleft} in worksheet @var{wsh} in an Excel +## spreadsheet file pointed to in structure @var{range}. +## Return argument @var{xlso} equals supplied argument @var{xlsi} and is +## updated by oct2jxla2xls. +## +## oct2jxla2xls should not be invoked directly but rather through oct2xls. +## +## Example: +## +## @example +## [xlso, status] = oct2jxla2oct ('arr', xlsi, 'Third_sheet', 'AA31'); +## @end example +## +## @seealso oct2xls, xls2oct, xlsopen, xlsclose, xlsread, xlswrite, xls2jxla2oct +## +## @end deftypefn + +## Author: Philip Nienhuis +## Created: 2009-12-04 +## Last updated 2009-12-11 + +function [ xls, rstatus ] = oct2jxla2xls (obj, xls, wsh, topleftcell="A1") + + persistent ctype; + if (isempty (ctype)) + ctype = [1, 2, 3, 4, 5]; + # Boolean, Number, String, NaN, Empty + endif + + # scratch vars + rstatus = 0; changed = 1; + + # Preliminary sanity checks + if (isempty (obj)) + warning ("Request to write empty matrix."); + rstatus = 1; + return; + elseif (~iscell(obj)) + error ("First argument is not a cell array"); + endif + if (nargin < 2) error ("oct2java2xls needs a minimum of 2 arguments."); endif + if (nargin == 2) wsh = 1; endif + if (~strmatch(tolower(xls.filename(end-4:end)), '.xls')) # FIXME for OOXML + error ("oct2java2xls can only write to Excel .xls files") + endif + + # Prepare workbook pointer if needed + if (xls.changed < 2) + # Create writable copy of workbook. If 2 a writable wb was made in xlsopen + xlsout = java_new ('java.io.File', xls.filename); + wb = java_invoke ('jxl.Workbook', 'createWorkbook', xlsout, xls.workbook); + xls.changed = 1; # For in case we come from reading the file + xls.workbook = wb; + else + wb = xls.workbook; + endif + + # Check if requested worksheet exists in the file & if so, get pointer + nr_of_sheets = xls.workbook.getNumberOfSheets(); # 1 based !! + if (isnumeric (wsh)) + if (wsh > nr_of_sheets) + # Watch out as a sheet called Sheet%d can exist with a lower index... + strng = sprintf ("Sheet%d", wsh); + ii = 1; + while (~isempty (wb.getSheet (strng)) && (ii < 5)) + strng = ['_' strng]; + ++ii; + endwhile + if (ii >= 5) error (sprintf( " > 5 sheets named [_]Sheet%d already present!", wsh)); endif + sh = wb.createSheet (strng, nr_of_sheets); ++nr_of_sheets; + else + sh = wb.getSheet (wsh - 1); # POI sheet count 0-based + endif + shnames = char(wb.getSheetNames ()); + printf ("(Writing to worksheet %s)\n", shnames {nr_of_sheets, 1}); + else + sh = wb.getSheet (wsh); + if (isempty(sh)) + # Sheet not found, just create it + sh = wb.createSheet (wsh, nr_of_sheets); + ++nr_of_sheets; + xls.changed = 2; + endif + endif + + # Beware of strings variables interpreted as char arrays; change them to cell. + if (ischar (obj)) obj = {obj}; endif + + [topleft, nrows, ncols, trow, lcol] = parse_sp_range (topleftcell); + [nrows, ncols] = size (obj); + + # Prepare type array to speed up writing + typearr = 5 * ones (nrows, ncols); # type "EMPTY", provisionally + obj2 = cell (size (obj)); # Temporary storage for strings + + txtptr = cellfun ('isclass', obj, 'char'); # type "STRING" replaced by "NUMERIC" + obj2(txtptr) = obj(txtptr); obj(txtptr) = 3; # Save strings in a safe place + + emptr = cellfun ("isempty", obj); + obj(emptr) = 5; # Set empty cells to NUMERIC + + lptr = cellfun ("islogical" , obj); # Find logicals... + obj2(lptr) = obj(lptr); # .. and set them to BOOLEAN + + ptr = cellfun ("isnan", obj); # Find NaNs & set to BLANK + typearr(ptr) = 4; typearr(~ptr) = 2; # All other cells are now numeric + + obj(txtptr) = obj2(txtptr); # Copy strings back into place + obj(lptr) = obj2(lptr); + typearr(txtptr) = 3; # ...and clean up + typearr(emptr) = 5; + typearr(lptr) = 1; # BOOLEAN + + # Write date to worksheet + for ii=1:nrows + ll = ii + trow - 2; # Java JExcelAPI's row count = 0-based + for jj=1:ncols + kk = jj + lcol - 2; # JExcelAPI's column count is also 0-based + switch typearr(ii, jj) + case 1 # Boolean + tmp = java_new ('jxl.write.Boolean', kk, ll, obj{ii, jj}); + sh.addCell (tmp); + case 2 # Numerical + tmp = java_new ('jxl.write.Number', kk, ll, obj{ii, jj}); + sh.addCell (tmp); + case 3 # String + tmp = java_new ('jxl.write.Label', kk, ll, obj{ii, jj}); + sh.addCell (tmp); + otherwise + # Just skip + endswitch + endfor + endfor + + rstatus = 1; + +endfunction Added: trunk/octave-forge/main/io/inst/oct2xls.m =================================================================== --- trunk/octave-forge/main/io/inst/oct2xls.m (rev 0) +++ trunk/octave-forge/main/io/inst/oct2xls.m 2009-12-11 22:05:43 UTC (rev 6637) @@ -0,0 +1,105 @@ +## Copyright (C) 2009 Philip Nienhuis <prnienhuis at users.sf.net> +## +## 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 2 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 Octave; see the file COPYING. If not, see +## <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} [ @var{xls}, @var{rstatus} ] = oct2xls (@var{arr}, @var{xls}) +## @deftypefnx {Function File} [ @var{xls}, @var{rstatus} ] = oct2xls (@var{arr}, @var{xls}, @var{wsh}) +## @deftypefnx {Function File} [ @var{xls}, @var{rstatus} ] = oct2xls (@var{arr}, @var{xls}, @var{wsh}, @var{topleft}) +## +## Add data in 1D/2D CELL array @var{arr} into a range with upper left +## cell equal to @var{topleft} in worksheet @var{wsh} in an Excel +## spreadsheet file pointed to in structure @var{range}. +## Return argument @var{xlso} equals supplied argument @var{xlsi} and is +## updated by oct2xls. +## +## oct2xls is a mere wrapper for interface-dependent scripts (e.g., +## oct2com2xls, oct2jpoi2xls, oct2jxla2xls) that do the actual writing to +## spreadsheet files. +## +## A subsequent call to xlsclose is needed to write the updated spreadsheet +## to disk (and -if needed- close the Excel or Java invocation). +## +## @var{arr} can be any array type save complex. Mixed numeric/text arrays +## can only be cell arrays. +## +## @var{xls} must be a valid pointer struct created earlier by xlsopen. +## +## @var{wsh} can be a number or string (max. 31 chars). +## In case of a yet non-existing Excel file, the first worksheet will be +## used & named according to @var{wsh} - the extra worksheets that Excel +## creates by default are deleted. +## In case of existing files, some checks are made for existing worksheet +## names or numbers, or whether @var{wsh} refers to an existing sheet with +## a type other than worksheet (e.g., chart). +## When new worksheets are to be added to the Excel file, they are +## inserted to the right of all existing worksheets. The pointer to the +## "active" sheet (shown when Excel opens the file) remains untouched. +## +## If omitted, @var{topleft} is supposed to be 'A1'. The actual range to +## be used is determined by the size of @var{arr}. +## +## Data are added to the worksheet, ignoring other data already present; +## existing data in the range to be used will be overwritten. +## +## If @var{range} contains merged cells, only the elements of @var{arr} +## corresponding to the top or left Excel cells of those merged cells +## will be written, other array cells corresponding to that cell will be +## ignored. +## +## Beware that -if invoked- Excel invocations may be left running silently +## in case of COM errors. Invoke xlsclose with proper pointer struct to +## close them. +## +## Examples: +## +## @example +## [xlso, status] = xls2oct ('arr', xlsi, 'Third_sheet', 'AA31'); +## @end example +## +## @seealso xls2oct, xlsopen, xlsclose, xlsread, xlswrite, oct2com2xls, oct2jpoi2xls, oct2jxla2xls +## +## @end deftypefn + +## Author: Philip Nienhuis +## Created: 2009-12-01 +## Latest update: 2009-12-11 + +function [ xls, rstatus ] = oct2xls (obj, xls, wsh, topleft='A1') + + if (isnumeric (obj)) + obj = num2cell (obj); + elseif (ischar (obj)) + obj = {obj}; + endif + + if (strcmp (xls.xtype, 'COM')) + # Call oct2com2xls to do the work + [xls, rstatus] = oct2com2xls (obj, xls, wsh, topleft); + + elseif (strcmp (xls.xtype, 'POI')) + # Invoke Java and Apache POI + [xls, rstatus] = oct2jpoi2xls (obj, xls, wsh, topleft); + + elseif (strcmp (xls.xtype, 'JXL')) + # Invoke Java and JExcelAPI + [xls, rstatus] = oct2jxla2xls (obj, xls, wsh, topleft); + +# elseif (strcmp'xls.xtype, '<whatever>')) +# <Other Excel interfaces> + + endif + +endfunction Added: trunk/octave-forge/main/io/inst/parse_sp_range.m =================================================================== --- trunk/octave-forge/main/io/inst/parse_sp_range.m (rev 0) +++ trunk/octave-forge/main/io/inst/parse_sp_range.m 2009-12-11 22:05:43 UTC (rev 6637) @@ -0,0 +1,100 @@ +## Copyright (C) 2009 Philip Nienhuis <pr.nienhuis at users.sf.net> +## +## 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 2 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 Octave; see the file COPYING. If not, see +## <http://www.gnu.org/licenses/>. + +## parse_sp_range +## Parse a string representing a range of cells for a spreadsheet +## into nr of rows and nr of columns and also extract top left +## cell address + top row+ left column. Some error checks are implemented. + +## Author: Philip Nienhuis +## Created: 2009-06-20 +## Latest update 2009-12-11 + +function [topleft, nrows, ncols, toprow, lcol] = parse_sp_range (range_org) + + # This entire function needs fixing or replacement for OOXML (larger ranges) + + range = deblank (toupper (range_org)); + range_error = 0; nrows = 0; ncols = 0; + + if (index (range, ':') == 0) + if (isempty (range)) + range_error = 0; + leftcol = 'A'; + rightcol = 'A'; + else + # Only upperleft cell given, just complete range to 1x1 + range = [range ":" range]; + endif + endif + [topleft, lowerright] = strtok (range, ':'); + [st, en] = regexp (topleft, '\d+'); + toprow = str2num (topleft(st:en)); + leftcol = deblank (topleft(1:st-1)); + [st, en1] = regexp( leftcol,'\s+'); + if (isempty (en1)) + en1=0; + endif + [st, en2] = regexp (leftcol,'\D+'); + leftcol = leftcol(en1+1:en2); + + [st, en] = regexp (lowerright,'\d+'); + bottomrow = str2num (lowerright(st:en)); + rightcol = deblank (lowerright(2:st-1)); + [st, en1] = regexp (rightcol,'\s+'); + if (isempty (en1)) + en1=0; + endif + [st, en2] = regexp (rightcol,'\D+'); + rightcol = rightcol(en1+1:en2); + nrows = bottomrow - toprow + 1; + if (nrows < 1) + range_error = 1; + endif + + if (range_error == 0) + # Get columns. + # FIXME for OOXML! We provisonally assume Excel 97 format, max 256 columns + ncols = 0; + [st, en1] = regexp (leftcol, '\D+'); + [st, en2] = regexp (rightcol, '\D+'); + i1= 0; i2 = 0; + if (en2 > en1) + i1 = rightcol(2:2) - leftcol(1:1) + 1; + i2 = rightcol(1:1) - 'A'+ 1; + lcol = leftcol(1:1) - 'A' + 1; + elseif (en2 == en1) + i1 = rightcol(en2) - leftcol(en2) + 1; + lcol = leftcol(1:1) - 'A' + 1; + if (en2 == 2) + i2 = rightcol(1) - leftcol(1); + lcol = lcol * 26 + (leftcol(2:2) - 'A' + 1); + endif + else + range_error = 1; + endif + ncols = i1 + 26 * i2; + if (ncols < 1) + range_error = 1; + endif + endif + + if (range_error > 0) + ncols = 0; nrows = 0; + error ("Spreadsheet range error! "); + endif + +endfunction Added: trunk/octave-forge/main/io/inst/parsecell.m =================================================================== --- trunk/octave-forge/main/io/inst/parsecell.m (rev 0) +++ trunk/octave-forge/main/io/inst/parsecell.m 2009-12-11 22:05:43 UTC (rev 6637) @@ -0,0 +1,125 @@ +## Copyright (C) 2009 Philip Nienhuis <prnienhuis at users.sf.net> +## +## 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 2 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 Octave; see the file COPYING. If not, see +## <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} [ @var{numarr}, @var{txtarr}, @var{lim} ] = parsecell (@var{rawarr}) +## +## Divide a heterogeneous 2D cell array into a 2D numeric array and a +## 2D cell array containing only strings. Both returned arrays are +## trimmed from empty outer rows and columns. +## +## Optional return argument @var{lim} contains two field with the outer +## column and row numbers of @var{numarr} and @var{txtarr} in the +## original @var{rawarr}. +## +## Example: +## +## @example +## [An, Tn] = parsecell (Rn); +## (which returns the numeric contents of Rn into array An and the +## text data into array Tn) +## @end example +## +## @seealso xlsread, xls2oct +## +## @end deftypefn + +## Author: Philip Nienhuis +## Created: 2009-12-11 + +function [ numarr, txtarr, lim ] = parsecell (rawarr) + + lim = struct ( "numlimits", [], "txtlimits", [] ); + + numarr = []; + txtarr = {}; + + if (~isempty (rawarr)) + # Valid data returned. Divide into numeric & text arrays + no_txt = 0; no_num = 0; + if (isnumeric ([rawarr{:}])) + numarr = num2cell (rawarr); + no_txt = 1; + elseif (iscellstr (rawarr)) + txtarr = cellstr (rawarr); + no_num = 1; + endif + # Prepare parsing + [nrows, ncols] = size (rawarr); + + # Find text entries in raw data cell array + txtptr = cellfun ('isclass', rawarr, 'char'); + if (~no_txt) + # Prepare text array. Create placeholder for text cells + txtarr = cell (size (rawarr)); + txtarr(:) = {''}; + if (any (any (txtptr))) + # Copy any text cells found into place holder + txtarr(txtptr) = rawarr(txtptr); + # Clean up text array (find leading / trailing empty + # rows & columns) + irowt = 1; + while (~any (txtptr(irowt, :))) irowt++; endwhile + irowb = nrows; + while (~any (txtptr(irowb, :))) irowb--; endwhile + icoll = 1; + while (~any (txtptr(:, icoll))) icoll++; endwhile + icolr = ncols; + while (~any (txtptr(:, icolr))) icolr--; endwhile + # Crop textarray + txtarr = txtarr(irowt:irowb, icoll:icolr); + lim.txtlimits = [icoll, icolr; irowt, irowb]; + else + # If no text cells found return empty text array + txtarr = {}; + endif + endif + + if (~no_num) + # Prepare numeric array. Set all text & empty cells to + # NaN. First get their locations + emptr = cellfun ('isempty', rawarr); + emptr(find (txtptr)) = 1; + if (all (all (emptr))) + numarr= []; + else + # Find leading & trailing empty rows + irowt = 1; + while (all(emptr(irowt, :))) irowt++; endwhile + irowb = nrows; + while (all(emptr(irowb, :))) irowb--; endwhile + icoll = 1; + while (all(emptr(:, icoll))) icoll++; endwhile + icolr = ncols; + while (all(emptr(:, icolr))) icolr--; endwhile + # Put numvalues column by column into temporary storage while + # skipping leading & trailing NaN columns & -rows. + # As columns are usually bigger chunks than rows & octave + # stores arrays by column, building by columns is supposedly + # faster than bulding by rows + tmparr = cell (1, icolr-icoll+1); + for ii = icoll:icolr + tmpcol = rawarr(irowt:irowb, ii); + tmpcol(find (emptr(irowt:irowb, ii))) = NaN; + tmparr(ii) = cat (1, tmpcol{:}); + endfor + numarr = cat (2, tmparr{:}); + lim.numlimits = [icoll, icolr; irowt, irowb]; + endif + endif + endif + +endfunction Added: trunk/octave-forge/main/io/inst/xls2com2oct.m =================================================================== --- trunk/octave-forge/main/io/inst/xls2com2oct.m (rev 0) +++ trunk/octave-forge/main/io/inst/xls2com2oct.m 2009-12-11 22:05:43 UTC (rev 6637) @@ -0,0 +1,124 @@ +## Copyright (C)2009 P.R. Nienhuis, <pr.nienhuis at hccnet.nl> +## +## based on mat2xls by Michael Goffioul (2007) <mic...@sw...> +## +## 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 2 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{obj}, @var{rstatus}, @var{xls} ] = xls2com2oct (@var{xls}) +## @deftypefnx {Function File} [@var{obj}, @var{rstatus}, @var{xls} ] = xls2com2oct (@var{xls}, @var{wsh}) +## @deftypefnx {Function File} [@var{obj}, @var{rstatus}, @var{xls} ] = xls2com2oct (@var{xls}, @var{wsh}, @var{range}) +## Get cell contents in @var{range} in worksheet @var{wsh} in an Excel +## file pointed to in struct @var{xls} into the cell array @var{obj}. +## +## xls2com2oct should not be invoked directly but rather through xls2oct. +## +## Examples: +## +## @example +## [Arr, status, xls] = xls2com2oct (xls, 'Second_sheet', 'B3:AY41'); +## Arr = xls2com2oct (xls, 'Second_sheet'); +## @end example +## +## @seealso xls2oct, oct2xls, xlsopen, xlsclose, xlsread, xlswrite +## +## @end deftypefn + +## Author: Philip Nienhuis +## Created: 2009-09-23 +## Last updated 2009-12-11 + +function [obj, xls, rstatus ] = xls2com2oct (xls, wsh, range) + + rstatus = 0; obj = {}; + + # Basic checks + if (nargin < 2) error ("xls2com2oct needs a minimum of 2 arguments."); endif + if (size (wsh, 2) > 31) + warning ("Worksheet name too long - truncated") + wsh = wsh(1:31); + endif + + nrows = 0; + emptyrange = 0; + if ((nargin == 2) || (isempty (range))) + emptyrange = 1; + else + # Extract top_left_cell from range + [topleft, nrows, ncols] = parse_sp_range (range); + endif; + + if (nrows >= 1 || emptyrange) + # Check the file handle struct + test1 = ~isfield (xls, "xtype"); + test1 = test1 || ~isfield (xls, "workbook"); + test1 = test1 || ~strcmp (char (xls.xtype), 'COM'); + test1 = test1 || isempty (xls.workbook); + test1 = test1 || isempty (xls.app); + if test1 + error ("Invalid file pointer struct"); + endif + app = xls.app; + wb = xls.workbook; + wb_cnt = wb.Worksheets.count; + old_sh = 0; + if (isnumeric (wsh)) + if (wsh < 1 || wsh > wb_cnt) + errstr = sprintf ("Worksheet number: %d out of range 1-%d", wsh, wb_cnt); + error (errstr) + return + else + old_sh = wsh; + endif + else + # Find worksheet number corresponding to name in wsh + wb_cnt = wb.Worksheets.count; + for ii =1:wb_cnt + sh_name = wb.Worksheets(ii).name; + if (strcmp (sh_name, wsh)) old_sh = ii; endif + endfor + if (~old_sh) + errstr = sprintf ("Worksheet name \"%s\" not present", wsh); + error (errstr) + else + wsh = old_sh; + endif + endif + + sh = wb.Worksheets (wsh); + + if (emptyrange) + allcells = sh.UsedRange; + obj = allcells.Value; + else + # Get object from Excel sheet, starting at cell top_left_cell + r = sh.Range (topleft); + r = r.Resize (nrows, ncols); + obj = r.Value; + delete (r); + endif; + # Take care of actual singe cell range + if (isnumeric (obj) || ischar (obj)) + obj = {obj}; + endif + # If we get here, all seems to have gone OK + rstatus = 1; + + else + error ("No data read from Excel file"); + rstatus = 0; + + endif + +endfunction Added: trunk/octave-forge/main/io/inst/xls2jpoi2oct.m =================================================================== --- trunk/octave-forge/main/io/inst/xls2jpoi2oct.m (rev 0) +++ trunk/octave-forge/main/io/inst/xls2jpoi2oct.m 2009-12-11 22:05:43 UTC (rev 6637) @@ -0,0 +1,202 @@ +## Copyright (C) 2009 Philip Nienhuis <prnienhuis at users.sf.net> +## +## 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 2 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 Octave; see the file COPYING. If not, see +## <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} [@var{obj}, @var{rstatus}, @var{xls} ] = xls2jpoi2oct (@var{xls}) +## @deftypefnx {Function File} [@var{obj}, @var{rstatus}, @var{xls} ] = xls2jpoi2oct (@var{xls}, @var{wsh}) +## @deftypefnx {Function File} [@var{obj}, @var{rstatus}, @var{xls} ] = xls2jpoi2oct (@var{xls}, @var{wsh}, @var{range}) +## Get cell contents in @var{range} in worksheet @var{wsh} in an Excel +## file pointed to in struct @var{xls} into the cell array @var{obj}. +## @var{range} can be a range or just the top left cell of the range. +## +## xls2jpoi2oct should not be invoked directly but rather through xls2oct. +## +## Examples: +## +## @example +## [Arr, status, xls] = xls2jpoi2oct (xls, 'Second_sheet', 'B3:AY41'); +## B = xls2jpoi2oct (xls, 'Second_sheet', 'B3'); +## @end example +## +## @seealso xls2oct, oct2xls, xlsopen, xlsclose, xlsread, xlswrite, oct2jpoi2xls +## +## @end deftypefn + +## Author: Philip Nienhuis +## Created: 2009-11-23 +## Last updated 2009-12-11 + +function [ rawarr, xls, status ] = xls2jpoi2oct (xls, wsh, cellrange=[]) + + persistent ctype; + if (isempty (ctype)) + # Get enumrated cell types. Beware as they start at 0 not 1 + ctype(1) = java_get ('org.apache.poi.ss.usermodel.Cell', 'CELL_TYPE_NUMERIC'); + ctype(2) = java_get ('org.apache.poi.ss.usermodel.Cell', 'CELL_TYPE_STRING'); + ctype(3) = java_get ('org.apache.poi.ss.usermodel.Cell', 'CELL_TYPE_FORMULA'); + ctype(4) = java_get ('org.apache.poi.ss.usermodel.Cell', 'CELL_TYPE_BLANK'); + ctype(5) = java_get ('org.apache.poi.ss.usermodel.Cell', 'CELL_TYPE_BOOLEAN'); + ctype(6) = java_get ('org.apache.poi.ss.usermodel.Cell', 'CELL_TYPE_ERROR'); + endif + + status = 0; jerror = 0; + + # Check if xls struct pointer seems valid + test1 = ~isfield (xls, "xtype"); + test1 = test1 || ~isfield (xls, "workbook"); + test1 = test1 || ~strcmp (char (xls.xtype), 'POI'); + test1 = test1 || isempty (xls.workbook); + test1 = test1 || isempty (xls.app); + if test1 + error ("Invalid xls file struct"); + else + wb = xls.workbook; + endif + + # Check if requested worksheet exists in the file & if so, get pointer + nr_of_sheets = wb.getNumberOfSheets (); + if (isnumeric (wsh)) + if (wsh > nr_of_sheets), error (sprintf ("Worksheet # %d bigger than nr. of sheets (%d) in file %s", wsh, nr_of_sheets, xls.filename)); endif + sh = wb.getSheetAt (wsh - 1); # POI sheet count 0-based + printf ("(Reading from worksheet %s)\n", sh.getSheetName ()); + else + sh = wb.getSheet (wsh); + if (isempty (sh)), error (sprintf("Worksheet %s not found in file %s", wsh, xls.filename)); endif + end + + # Check ranges + firstrow = sh.getFirstRowNum (); + lastrow = sh.getLastRowNum (); + if (isempty (cellrange)) + # Get used range by searching (slow...). Beware, it can be bit unreliable + lcol = 65535; # FIXME for OOXML + rcol = 0; + for ii=firstrow:lastrow + irow = sh.getRow (ii); + if (~isempty (irow)) + scol = (irow.getFirstCellNum).intValue (); + lcol = min (lcol, scol); + ecol = (irow.getLastCellNum).intValue () - 1; + rcol = max (rcol, ecol); + # Keep track of lowermost non-empty row as getLastRowNum() is unreliable + if ~(irow.getCell(scol).getCellType () == ctype(4) && irow.getCell(ecol).getCellType () == ctype(4)) + botrow = ii; + endif + endif + endfor + lastrow = min (lastrow, botrow); + nrows = lastrow - firstrow + 1; + ncols = rcol - lcol + 1; + else + # Translate range to HSSF POI row & column numbers + [topleft, nrows, ncols, trow, lcol] = parse_sp_range (cellrange); + firstrow = max (trow-1, firstrow); + lastrow = firstrow + nrows - 1; + lcol = lcol -1; # POI rows & column # 0-based + endif + + # Create formula evaluator (needed to infer proper cell type into rawarr) + # NB formula evaluation is not very reliable in POI + frm_eval = wb.getCreationHelper().createFormulaEvaluator (); + + #wb.clearAllCachedResultsValues(); # does not work + + # Read contents into rawarr + rawarr = cell (nrows, ncols); # create placeholder + for ii = firstrow:lastrow + irow = sh.getRow (ii); + if ~isempty (irow) + scol = (irow.getFirstCellNum).intValue (); + ecol = (irow.getLastCellNum).intValue () - 1; + for jj = max (scol, lcol) : min (lcol+ncols-1, ecol) + cell = irow.getCell (jj); + if ~isempty (cell) + # Process cell contents + type_of_cell = cell.getCellType (); + if (type_of_cell == ctype(3)) # Formula + try + cell = frm_eval.evaluate (cell); + type_of_cell = cell.getCellType(); + switch type_of_cell + case ctype (1) # Numeric + rawarr (ii+1-firstrow, jj+1-lcol) = cell.getNumberValue (); + case ctype(2) # String + rawarr (ii+1-firstrow, jj+1-lcol) = char (cell.getStringValue ()); + case ctype (5) # Boolean + rawarr (ii+1-firstrow, jj+1-lcol) = cell.BooleanValue (); +... [truncated message content] |
From: <cd...@us...> - 2010-04-14 20:35:09
|
Revision: 7193 http://octave.svn.sourceforge.net/octave/?rev=7193&view=rev Author: cdf Date: 2010-04-14 20:35:02 +0000 (Wed, 14 Apr 2010) Log Message: ----------- svnignore Removed Paths: ------------- trunk/octave-forge/main/io/.svnignore trunk/octave-forge/main/io/inst/.svnignore trunk/octave-forge/main/io/src/.svnignore Deleted: trunk/octave-forge/main/io/.svnignore =================================================================== --- trunk/octave-forge/main/io/.svnignore 2010-04-14 20:07:08 UTC (rev 7192) +++ trunk/octave-forge/main/io/.svnignore 2010-04-14 20:35:02 UTC (rev 7193) @@ -1,3 +0,0 @@ -PKG_ADD -*.octlink -*.oct Deleted: trunk/octave-forge/main/io/inst/.svnignore =================================================================== --- trunk/octave-forge/main/io/inst/.svnignore 2010-04-14 20:07:08 UTC (rev 7192) +++ trunk/octave-forge/main/io/inst/.svnignore 2010-04-14 20:35:02 UTC (rev 7193) @@ -1,3 +0,0 @@ -PKG_ADD -*.octlink -*.oct Deleted: trunk/octave-forge/main/io/src/.svnignore =================================================================== --- trunk/octave-forge/main/io/src/.svnignore 2010-04-14 20:07:08 UTC (rev 7192) +++ trunk/octave-forge/main/io/src/.svnignore 2010-04-14 20:35:02 UTC (rev 7193) @@ -1,3 +0,0 @@ -PKG_ADD -*.octlink -*.oct This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <prn...@us...> - 2011-11-13 16:31:16
|
Revision: 9078 http://octave.svn.sourceforge.net/octave/?rev=9078&view=rev Author: prnienhuis Date: 2011-11-13 16:31:09 +0000 (Sun, 13 Nov 2011) Log Message: ----------- Java classes supposed to be in /<libdir>/java Added Paths: ----------- trunk/octave-forge/main/io/PKG_ADD trunk/octave-forge/main/io/PKG_DEL Added: trunk/octave-forge/main/io/PKG_ADD =================================================================== --- trunk/octave-forge/main/io/PKG_ADD (rev 0) +++ trunk/octave-forge/main/io/PKG_ADD 2011-11-13 16:31:09 UTC (rev 9078) @@ -0,0 +1,12 @@ +## PKG_ADD +## add paths of io pkg java jars if java pkg is installed and loaded +pkglist = pkg ("list"); +javapkgind = find (cellfun(@(x) strcmp(x.name, "java"), pkglist), 1, "first"); +if ~isempty (javapkgind) + javapkg = pkglist{javapkgind}; + if javapkg.loaded + # Assume jar files are in /lib/java and let chk_spreadsheet_support sort it out + libdir = octave_config_info("libdir"); + spr_status = chk_spreadsheet_support ([libdir "/java"]); + endif +endif Added: trunk/octave-forge/main/io/PKG_DEL =================================================================== --- trunk/octave-forge/main/io/PKG_DEL (rev 0) +++ trunk/octave-forge/main/io/PKG_DEL 2011-11-13 16:31:09 UTC (rev 9078) @@ -0,0 +1,7 @@ +## PKG_DEL +## +## Below are base names of spreadsheet I/O Java class libs. +## They'll stay (harmless) in the javaclasspath until termination of the current Octave session. +## {'poi-3', 'poi-ooxml-3', xbean', 'poi-ooxml-schemas', 'dom4j-1.6.1', 'jxl', 'openxls', ... +## 'odfdom', 'xercesImpl', 'jopendocument', ... +## 'program', 'unoil', 'jurt', 'juh', 'unoloader', 'ridl'} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <prn...@us...> - 2012-03-18 14:22:35
|
Revision: 9945 http://octave.svn.sourceforge.net/octave/?rev=9945&view=rev Author: prnienhuis Date: 2012-03-18 14:22:27 +0000 (Sun, 18 Mar 2012) Log Message: ----------- Update to v. 1.0.18 Modified Paths: -------------- trunk/octave-forge/main/io/DESCRIPTION trunk/octave-forge/main/io/INDEX trunk/octave-forge/main/io/NEWS Modified: trunk/octave-forge/main/io/DESCRIPTION =================================================================== --- trunk/octave-forge/main/io/DESCRIPTION 2012-03-18 13:31:18 UTC (rev 9944) +++ trunk/octave-forge/main/io/DESCRIPTION 2012-03-18 14:22:27 UTC (rev 9945) @@ -1,6 +1,6 @@ Name: io -Version: 1.0.17 -Date: 2012-02-27 +Version: 1.0.18 +Date: 2012-03-18 Author: Various Authors Maintainer: Philip Nienhuis <prn...@us...> Title: Input/Output Modified: trunk/octave-forge/main/io/INDEX =================================================================== --- trunk/octave-forge/main/io/INDEX 2012-03-18 13:31:18 UTC (rev 9944) +++ trunk/octave-forge/main/io/INDEX 2012-03-18 14:22:27 UTC (rev 9945) @@ -5,6 +5,13 @@ Miscellaneous conversion functions object2json pch2mat +CSV file functions + csv2cell + csvconcat + csvexplode +XML I/O + xmlread + xmlwrite Spreadsheet I/O user functions for MS-Excel oct2xls xls2oct Modified: trunk/octave-forge/main/io/NEWS =================================================================== --- trunk/octave-forge/main/io/NEWS 2012-03-18 13:31:18 UTC (rev 9944) +++ trunk/octave-forge/main/io/NEWS 2012-03-18 14:22:27 UTC (rev 9945) @@ -1,22 +1,25 @@ Summary of important user-visible changes for releases of the io package =============================================================================== -io-1.0.18 Release Date: TBA Release Manager: Philip Nienhuis +io-1.0.18 Release Date: 2012-03-18 Release Manager: Philip Nienhuis =============================================================================== +** The following functions have been imported from the miscellaneous package: + cell2csv csvconcat xmlread + csv2cell csvexplode xmlwrite + Their error messages and help messages have been cleaned up a bit. + ** Bug fixes: --- odsfinfo: fixed "wrong type argument `cell'" bug when run interactively. --- xlsopen, odsopen: fixed messed up screen output due to UNO usage warning. ---- csv2cell: checks if file is empty annd return an empty cell if so. +--- csv2cell: checks if file is empty and if so, return an empty cell. -** Adapted to internal LibreOffice-3.5-final changes. +** Adapted to internal LibreOffice-3.5-final changes. + Some bugs (flashing LO screens) still have to be fixed upstream - see here: + https://bugs.freedesktop.org/show_bug.cgi?id=42470 ** Tried OpenXLS-6.0.7.jar. Reads OK, still unusable for writing .xls files. -** The following functions have been imported from the miscellaneous package: - cell2csv csvconcat xmlread - csv2cell csvexplode xmlwrite - =============================================================================== io-1.0.17 Release Date: 2012-02-27 Release Manager: Philip Nienhuis =============================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <car...@us...> - 2012-03-21 00:22:49
|
Revision: 9985 http://octave.svn.sourceforge.net/octave/?rev=9985&view=rev Author: carandraug Date: 2012-03-21 00:22:42 +0000 (Wed, 21 Mar 2012) Log Message: ----------- io: update license to GPLv3+ on DESCRIPTION AND COPYING file. Also mention simplified BSD on DESCRIPTION because of pch2mat.m Modified Paths: -------------- trunk/octave-forge/main/io/COPYING trunk/octave-forge/main/io/DESCRIPTION Modified: trunk/octave-forge/main/io/COPYING =================================================================== --- trunk/octave-forge/main/io/COPYING 2012-03-21 00:15:43 UTC (rev 9984) +++ trunk/octave-forge/main/io/COPYING 2012-03-21 00:22:42 UTC (rev 9985) @@ -1,283 +1,625 @@ GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + Version 3, 29 June 2007 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. <http://fsf.org/> + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + The precise terms and conditions for copying, distribution and modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". + TERMS AND CONDITIONS -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. + 0. Definitions. - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. + "This License" refers to version 3 of the GNU General Public License. -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. + A "covered work" means either the unmodified Program or a work based +on the Program. - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: + 1. Source Code. - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. + The Corresponding Source for a work in source code form is that +same work. - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of this License. - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. + 13. Use with the GNU Affero General Public License. -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. + 14. Revised Versions of this License. - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. - NO WARRANTY + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. + 15. Disclaimer of Warranty. - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + END OF TERMS AND CONDITIONS - + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest @@ -286,15 +628,15 @@ To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least +state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> - This program is free software; you can redistribute it and/or modify + 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 2 of the License, or + 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, @@ -303,35 +645,30 @@ 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/>. + along with this program. If not, see <http://www.gnu.org/licenses/>. Also add information on how to contact you by electronic and paper mail. -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. Modified: trunk/octave-forge/main/io/DESCRIPTION =================================================================== --- trunk/octave-forge/main/io/DESCRIPTION 2012-03-21 00:15:43 UTC (rev 9984) +++ trunk/octave-forge/main/io/DESCRIPTION 2012-03-21 00:22:42 UTC (rev 9985) @@ -1,14 +1,15 @@ Name: io Version: 1.0.18 Date: 2012-03-18 -Author: Various Authors +Author: various authors Maintainer: Philip Nienhuis <prn...@us...> Title: Input/Output Description: Input/Output in external formats. Categories: IO -Problems: Default initial java memory probably too small, increase with java.opts (see documentation). No OXS write support. UNO support experimental +Problems: Default initial java memory probably too small, increase with + java.opts (see documentation). No OXS write support. UNO support experimental. Depends: octave (>= 3.4.0) Suggested: java-1.2.8+ f Windows, windows-1.0.10+ f Windows, java-1.2.8 f linux Autoload: yes -License: GPL version 2 or later +License: GPLv3+, simplified BSD Url: http://octave.sf.net This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <prn...@us...> - 2012-06-08 16:45:45
|
Revision: 10599 http://octave.svn.sourceforge.net/octave/?rev=10599&view=rev Author: prnienhuis Date: 2012-06-08 16:45:39 +0000 (Fri, 08 Jun 2012) Log Message: ----------- Updated to release 1.0.19 Modified Paths: -------------- trunk/octave-forge/main/io/DESCRIPTION trunk/octave-forge/main/io/NEWS Modified: trunk/octave-forge/main/io/DESCRIPTION =================================================================== --- trunk/octave-forge/main/io/DESCRIPTION 2012-06-08 16:39:09 UTC (rev 10598) +++ trunk/octave-forge/main/io/DESCRIPTION 2012-06-08 16:45:39 UTC (rev 10599) @@ -1,6 +1,6 @@ Name: io -Version: 1.0.18 -Date: 2012-03-22 +Version: 1.0.19 +Date: 2012-06-08 Author: various authors Maintainer: Philip Nienhuis <prn...@us...> Title: Input/Output Modified: trunk/octave-forge/main/io/NEWS =================================================================== --- trunk/octave-forge/main/io/NEWS 2012-06-08 16:39:09 UTC (rev 10598) +++ trunk/octave-forge/main/io/NEWS 2012-06-08 16:45:39 UTC (rev 10599) @@ -1,6 +1,8 @@ Summary of important user-visible changes for releases of the io package -post-1.0.18 (in SVN only) +=============================================================================== +io-1.0.19 Release Date: 2012-06-08 Release Manager: Philip Nienhuis +=============================================================================== ** Bug fixes: --- getusedrange subfunc getusedrange_jod: str2num applied to indices rather This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <prn...@us...> - 2012-09-07 14:11:58
|
Revision: 10971 http://octave.svn.sourceforge.net/octave/?rev=10971&view=rev Author: prnienhuis Date: 2012-09-07 14:11:47 +0000 (Fri, 07 Sep 2012) Log Message: ----------- CRLF to LF Modified Paths: -------------- trunk/octave-forge/main/io/INDEX trunk/octave-forge/main/io/PKG_ADD trunk/octave-forge/main/io/PKG_DEL Modified: trunk/octave-forge/main/io/INDEX =================================================================== --- trunk/octave-forge/main/io/INDEX 2012-09-07 12:58:28 UTC (rev 10970) +++ trunk/octave-forge/main/io/INDEX 2012-09-07 14:11:47 UTC (rev 10971) @@ -1,44 +1,45 @@ -io >> Input from and output to external formats -File I/O - append_save - fexist -Miscellaneous conversion functions - object2json - pch2mat -CSV file functions - csv2cell - csvconcat - csvexplode - cell2csv -XML I/O - xmlread - xmlwrite -Spreadsheet I/O user functions for MS-Excel - oct2xls - xls2oct - xlsclose - xlsfinfo - xlsopen - xlsread - xlswrite -Spreadsheet I/O user functions for OpenOffice.org Calc - oct2ods - ods2oct - odsclose - odsfinfo - odsopen - odsread - odswrite -Spreadsheet utility functions - calccelladdress - chk_spreadsheet_support - parsecell -Spreadsheet I/O internal functions - getusedrange - parse_sp_range - spsh_chkrange - spsh_prstype -Spreadsheet function test scripts - io_xls_testscript - io_ods_testscript - +io >> Input from and output to external formats + File I/O + append_save + fexist + Miscellaneous conversion functions + object2json + pch2mat + CSV file functions + csv2cell + csvconcat + csvexplode + cell2csv + XML I/O + xmlread + xmlwrite + Spreadsheet I/O user functions for MS-Excel + oct2xls + xls2oct + xlsclose + xlsfinfo + xlsopen + xlsread + xlswrite + Spreadsheet I/O user functions for OpenOffice.org Calc + oct2ods + ods2oct + odsclose + odsfinfo + odsopen + odsread + odswrite + Spreadsheet utility functions + calccelladdress + chk_spreadsheet_support + parsecell + Spreadsheet I/O internal functions + getusedrange + parse_sp_range + spsh_chkrange + spsh_prstype + Spreadsheet function test scripts + io_xls_testscript + io_ods_testscript + + \ No newline at end of file Modified: trunk/octave-forge/main/io/PKG_ADD =================================================================== --- trunk/octave-forge/main/io/PKG_ADD 2012-09-07 12:58:28 UTC (rev 10970) +++ trunk/octave-forge/main/io/PKG_ADD 2012-09-07 14:11:47 UTC (rev 10971) @@ -1,16 +1,17 @@ -## PKG_ADD -## add paths of io pkg java jars if java pkg is installed and loaded -pkglist = pkg ("list"); -javapkgind = find (cellfun (@(x) strcmp(x.name, "java"), pkglist), 1, "first"); -if (! isempty (javapkgind)) - javapkg = pkglist{javapkgind}; - if (javapkg.loaded) - # Assume jar files are in /lib/java and let chk_spreadsheet_support sort it out - libdir = octave_config_info ("libdir"); - ## Allow time for package to be fully loaded - pause (0.25); - spr_status = chk_spreadsheet_support ([ libdir filesep "java" ]); - endif -endif -## Clean up -clear javapkgind javapkg libdir spr_status pkglist ; \ No newline at end of file +## PKG_ADD + ## add paths of io pkg java jars if java pkg is installed and loaded + pkglist = pkg ("list"); + javapkgind = find (cellfun (@(x) strcmp(x.name, "java"), pkglist), 1, "first"); + if (! isempty (javapkgind)) + keyboard + javapkg = pkglist{javapkgind}; + if (javapkg.loaded) + # Assume jar files are in /lib/java and let chk_spreadsheet_support sort it out + libdir = octave_config_info ("libdir"); + ## Allow time for package to be fully loaded + pause (0.25); + spr_status = chk_spreadsheet_support ([ libdir filesep "java" ]); + endif + endif + ## Clean up + clear javapkgind javapkg libdir spr_status pkglist ; \ No newline at end of file Modified: trunk/octave-forge/main/io/PKG_DEL =================================================================== --- trunk/octave-forge/main/io/PKG_DEL 2012-09-07 12:58:28 UTC (rev 10970) +++ trunk/octave-forge/main/io/PKG_DEL 2012-09-07 14:11:47 UTC (rev 10971) @@ -1,7 +1,8 @@ -## PKG_DEL -## -## Below are base names of spreadsheet I/O Java class libs. -## They'll stay (harmless) in the javaclasspath until termination of the current Octave session. -## {'poi-3', 'poi-ooxml-3', xbean', 'poi-ooxml-schemas', 'dom4j-1.6.1', 'jxl', 'openxls', ... -## 'odfdom', 'xercesImpl', 'jopendocument', ... -## 'program', 'unoil', 'jurt', 'juh', 'unoloader', 'ridl'} +## PKG_DEL + ## + ## Below are base names of spreadsheet I/O Java class libs. + ## They'll stay (harmless) in the javaclasspath until termination of the current Octave session. + ## {'poi-3', 'poi-ooxml-3', xbean', 'poi-ooxml-schemas', 'dom4j-1.6.1', 'jxl', 'openxls', ... + ## 'odfdom', 'xercesImpl', 'jopendocument', ... + ## 'program', 'unoil', 'jurt', 'juh', 'unoloader', 'ridl'} + \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <prn...@us...> - 2012-09-07 14:15:31
|
Revision: 10975 http://octave.svn.sourceforge.net/octave/?rev=10975&view=rev Author: prnienhuis Date: 2012-09-07 14:15:24 +0000 (Fri, 07 Sep 2012) Log Message: ----------- version bumped to 1.0.20 Modified Paths: -------------- trunk/octave-forge/main/io/DESCRIPTION trunk/octave-forge/main/io/NEWS Modified: trunk/octave-forge/main/io/DESCRIPTION =================================================================== --- trunk/octave-forge/main/io/DESCRIPTION 2012-09-07 14:14:41 UTC (rev 10974) +++ trunk/octave-forge/main/io/DESCRIPTION 2012-09-07 14:15:24 UTC (rev 10975) @@ -1,6 +1,6 @@ Name: io -Version: 1.0.19 -Date: 2012-06-08 +Version: 1.0.20 +Date: 2012-09-07 Author: various authors Maintainer: Philip Nienhuis <prn...@us...> Title: Input/Output Modified: trunk/octave-forge/main/io/NEWS =================================================================== --- trunk/octave-forge/main/io/NEWS 2012-09-07 14:14:41 UTC (rev 10974) +++ trunk/octave-forge/main/io/NEWS 2012-09-07 14:15:24 UTC (rev 10975) @@ -1,146 +1,147 @@ -Summary of important user-visible changes for releases of the io package - -=============================================================================== -io-1.0.20 Release Date: 2012-TBA Release Manager: Philip Nienhuis -=============================================================================== - -** Bug fixes: ---- xlsopen, xlsclose, odsopen, odsclose: replaced canonicalize_file_name call - with make_absolute_filename for non-windows systems (canonicalize_file_name - doesn't work with non-existent (new) files on *nix) (bug #36677); - Web addresses (URLs) only need two rather than three slashes; ---- xlsopen: matching .jar names to javaclasspath entries worked the wrong way ---- io_xls_testscript / io_ods_testscript: added small delay for UNO calls to - avoid lock-ups with recent LibreOffice (3.6.x) - -** The annoying flashing LibreOffice splash screens have been fixed upstream; - with LibreOffice 3.6.1 I didn't see them anymore - -** Extended file rename section in odsclose similar to that in xlsclose - -=============================================================================== -io-1.0.19 Release Date: 2012-06-08 Release Manager: Philip Nienhuis -=============================================================================== - -** Bug fixes: ---- getusedrange subfunc getusedrange_jod: str2num applied to indices rather - than the substring. Must have been there for > 2 years, only surfaced - with jopendocument v 1.3b1 ---- oct2xls, oct2ods: cast all numeric types in input array to double as - spreadsheets have only double, boolean or character string type. This bug - has been there from the very beginning of the spreadsheet functions >8-O - ---- Support for reading back formulas from .xls spreadsheets using ActiveX/COM - -** Compatible with jOpenDocument version 1.3b1 - getUsedRange() method added (MUCH faster than the old hack) - -** Compatible with odfdom-java-0.8.8-incubator.jar (ODF Toolkit 0.5-incubating) - -** Compatible with Apache POI 3.8 final - -=============================================================================== -io-1.0.18 Release Date: 2012-03-22 Release Manager: Philip Nienhuis -=============================================================================== - -** The following functions have been imported from the miscellaneous package: - cell2csv csvconcat xmlread - csv2cell csvexplode xmlwrite - Their error messages and help messages have been cleaned up a bit. - -** Bug fixes: ---- odsfinfo: fixed "wrong type argument `cell'" bug when run interactively. ---- xlsopen, odsopen: fixed messed up screen output due to UNO usage warning. ---- csv2cell: checks if file is empty and if so, return an empty cell. ---- xlsopen: better Java detection logic, more informative error messages - -** Adapted to internal LibreOffice-3.5-final changes. - Some bugs (flashing LO screens) still have to be fixed upstream - see here: - https://bugs.freedesktop.org/show_bug.cgi?id=42470 - -** Tried OpenXLS-6.0.7.jar. Reads OK, still unusable for writing .xls files. - -=============================================================================== -io-1.0.17 Release Date: 2012-02-27 Release Manager: Philip Nienhuis -=============================================================================== - -** Bug fixes: ---- oct2ods, oct2xls, odswrite default range input arg. These functions may not - have worked properly for two years (!) - -** Fixed support for odfdom v.0.8.7 (ODS). Note: the OTK interface only works - well with xercesImpl.jar 2.9.1 (Sep 14, 2009) - -** Many small bug fixes & documentation updated to actual functionality. - -** Fixed "seealso" texinfo header string in almost all functions. - -** Added formal test scripts to "internal functions" section. - -=============================================================================== -io-1.0.16 Release Date: 2012-01-19 Release Manager: Philip Nienhuis -=============================================================================== - -** Bug fixing release - -** PKG_ADD now expects Java spreadsheet class libs (.jars) in /lib/java - (for MinGW) - -=============================================================================== -io-1.0.15 Release Date: 2011-10-02 Release Manager: Philip Nienhuis -=============================================================================== - -io-1.0.15 is primarily a bug fix release and a snapshot / wrap-up of current - development status (some still a bit experimental). It mainly comprises: - -** A number of bug fixes (incl. some serious ones, notably with .ods/OOo Calc); - -** Some mainly cosmetic improvements to existing code; less verbosity; - -** pch2mat (reading & transforming Nastran PCH files, contributed by - B. Oytun Peksel); - -** object2json.m (creating a json description string of objects, contributed - by Daniel Torre). This was already silently introduced in io-1.0.14; - -** A scripted troubleshooting / classpath setup tool for spreadsheet I/O - support (chk_spreadsheet_support.m); - -** Experimental OXS support (OpenXLS) for reading Excel xls (BIFF8). - OpenXLS is -let's say- a little bit lacking: For reading it is faster than - JXL. However, while OXS write support has been coded (and works) I had to - disable it as the OXS Java classes won't release the file handle so Octave - will hang upon closing :-( I'm stuck with this so I just release it as-is; - -** Experimental UNO support, i.e. invoking OpenOffice.org (or clones like - LibreOffice) behind the scenes to read spreadsheet files, much like - ActiveX/COM for MS-Excel. This is also based on Java. The first time you - use UNO, OOo has to be loaded and you'll have to be patient, but once loaded - (and in the OS cache) you'll see the pros: - --* Very fast; - --* Much lower Java memory usage as OOo loads the spreadsheet in its own - memory chunk (not Octave's) => much bigger spreadsheet capacity; - --* You can read *all* formats supported by OOo: .ods, .xls, .csv, .xlsx, - .sxc, .dbf, Lotus wk1, Quattro Pro, ......; and it doesn't really matter - whether xlsopen of odsopen is used. - Of course all this wonderful stuff comes at a prize: - --* After closing the spreadsheet file (odsclose, xlsclose) ALL OOo - invocations will be closed, also those started outside Octave. This is - due to "the way OpenOffice works" (quoted from OOo dev forum), especially - through Java. There are other ways to close OOo but they'll hang Octave; - --* The Java UNO classes supplied with e.g. LibreOffice aren't kept quite - up-to-date with the main program. As a consequence, with e.g., - LibreOffice 3.4 the main LO window will pop up (it can't be hidden). I - filed a bug report for this - (https://bugs.freedesktop.org/show_bug.cgi?id=40991) but I haven't seen - it being picked up yet. Another example: while LO 3.3.1's row capacity - was already > 10^6, it took until LO 3.4 before this capacity was - implemented in the Java UNO classes. - Like with OXS, I'm a bit stuck here - all this has to be fixed upstream. - -Hint: -for older Octave versions (< 3.4.0) you can install io-1.0.15 using the -nodeps - flag. You'll then loose the old and buggy textread and csv/dlm-read/write - functions but I'd consider that as no big loss. - - <please scroll up/back to see rest of io NEWS> +Summary of important user-visible changes for releases of the io package + + =============================================================================== + io-1.0.20 Release Date: 2012-09-07 Release Manager: Philip Nienhuis + =============================================================================== + + ** Bug fixes: + --- xlsopen, xlsclose, odsopen, odsclose: replaced canonicalize_file_name call + with make_absolute_filename for non-windows systems (canonicalize_file_name + doesn't work with non-existent (new) files on *nix) (bug #36677); + Web addresses (URLs) only need two rather than three slashes; + --- xlsopen: matching .jar names to javaclasspath entries worked the wrong way + --- io_xls_testscript / io_ods_testscript: added small delay for UNO calls to + avoid lock-ups with recent LibreOffice (3.6.x) + + ** The annoying flashing LibreOffice splash screens have been fixed upstream; + with LibreOffice 3.6.1 I didn't see them anymore + + ** Extended file rename section in odsclose similar to that in xlsclose + + =============================================================================== + io-1.0.19 Release Date: 2012-06-08 Release Manager: Philip Nienhuis + =============================================================================== + + ** Bug fixes: + --- getusedrange subfunc getusedrange_jod: str2num applied to indices rather + than the substring. Must have been there for > 2 years, only surfaced + with jopendocument v 1.3b1 + --- oct2xls, oct2ods: cast all numeric types in input array to double as + spreadsheets have only double, boolean or character string type. This bug + has been there from the very beginning of the spreadsheet functions >8-O + + --- Support for reading back formulas from .xls spreadsheets using ActiveX/COM + + ** Compatible with jOpenDocument version 1.3b1 + getUsedRange() method added (MUCH faster than the old hack) + + ** Compatible with odfdom-java-0.8.8-incubator.jar (ODF Toolkit 0.5-incubating) + + ** Compatible with Apache POI 3.8 final + + =============================================================================== + io-1.0.18 Release Date: 2012-03-22 Release Manager: Philip Nienhuis + =============================================================================== + + ** The following functions have been imported from the miscellaneous package: + cell2csv csvconcat xmlread + csv2cell csvexplode xmlwrite + Their error messages and help messages have been cleaned up a bit. + + ** Bug fixes: + --- odsfinfo: fixed "wrong type argument `cell'" bug when run interactively. + --- xlsopen, odsopen: fixed messed up screen output due to UNO usage warning. + --- csv2cell: checks if file is empty and if so, return an empty cell. + --- xlsopen: better Java detection logic, more informative error messages + + ** Adapted to internal LibreOffice-3.5-final changes. + Some bugs (flashing LO screens) still have to be fixed upstream - see here: + https://bugs.freedesktop.org/show_bug.cgi?id=42470 + + ** Tried OpenXLS-6.0.7.jar. Reads OK, still unusable for writing .xls files. + + =============================================================================== + io-1.0.17 Release Date: 2012-02-27 Release Manager: Philip Nienhuis + =============================================================================== + + ** Bug fixes: + --- oct2ods, oct2xls, odswrite default range input arg. These functions may not + have worked properly for two years (!) + + ** Fixed support for odfdom v.0.8.7 (ODS). Note: the OTK interface only works + well with xercesImpl.jar 2.9.1 (Sep 14, 2009) + + ** Many small bug fixes & documentation updated to actual functionality. + + ** Fixed "seealso" texinfo header string in almost all functions. + + ** Added formal test scripts to "internal functions" section. + + =============================================================================== + io-1.0.16 Release Date: 2012-01-19 Release Manager: Philip Nienhuis + =============================================================================== + + ** Bug fixing release + + ** PKG_ADD now expects Java spreadsheet class libs (.jars) in /lib/java + (for MinGW) + + =============================================================================== + io-1.0.15 Release Date: 2011-10-02 Release Manager: Philip Nienhuis + =============================================================================== + + io-1.0.15 is primarily a bug fix release and a snapshot / wrap-up of current + development status (some still a bit experimental). It mainly comprises: + + ** A number of bug fixes (incl. some serious ones, notably with .ods/OOo Calc); + + ** Some mainly cosmetic improvements to existing code; less verbosity; + + ** pch2mat (reading & transforming Nastran PCH files, contributed by + B. Oytun Peksel); + + ** object2json.m (creating a json description string of objects, contributed + by Daniel Torre). This was already silently introduced in io-1.0.14; + + ** A scripted troubleshooting / classpath setup tool for spreadsheet I/O + support (chk_spreadsheet_support.m); + + ** Experimental OXS support (OpenXLS) for reading Excel xls (BIFF8). + OpenXLS is -let's say- a little bit lacking: For reading it is faster than + JXL. However, while OXS write support has been coded (and works) I had to + disable it as the OXS Java classes won't release the file handle so Octave + will hang upon closing :-( I'm stuck with this so I just release it as-is; + + ** Experimental UNO support, i.e. invoking OpenOffice.org (or clones like + LibreOffice) behind the scenes to read spreadsheet files, much like + ActiveX/COM for MS-Excel. This is also based on Java. The first time you + use UNO, OOo has to be loaded and you'll have to be patient, but once loaded + (and in the OS cache) you'll see the pros: + --* Very fast; + --* Much lower Java memory usage as OOo loads the spreadsheet in its own + memory chunk (not Octave's) => much bigger spreadsheet capacity; + --* You can read *all* formats supported by OOo: .ods, .xls, .csv, .xlsx, + .sxc, .dbf, Lotus wk1, Quattro Pro, ......; and it doesn't really matter + whether xlsopen of odsopen is used. + Of course all this wonderful stuff comes at a prize: + --* After closing the spreadsheet file (odsclose, xlsclose) ALL OOo + invocations will be closed, also those started outside Octave. This is + due to "the way OpenOffice works" (quoted from OOo dev forum), especially + through Java. There are other ways to close OOo but they'll hang Octave; + --* The Java UNO classes supplied with e.g. LibreOffice aren't kept quite + up-to-date with the main program. As a consequence, with e.g., + LibreOffice 3.4 the main LO window will pop up (it can't be hidden). I + filed a bug report for this + (https://bugs.freedesktop.org/show_bug.cgi?id=40991) but I haven't seen + it being picked up yet. Another example: while LO 3.3.1's row capacity + was already > 10^6, it took until LO 3.4 before this capacity was + implemented in the Java UNO classes. + Like with OXS, I'm a bit stuck here - all this has to be fixed upstream. + + Hint: + for older Octave versions (< 3.4.0) you can install io-1.0.15 using the -nodeps + flag. You'll then loose the old and buggy textread and csv/dlm-read/write + functions but I'd consider that as no big loss. + + <please scroll up/back to see rest of io NEWS> + \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <prn...@us...> - 2012-09-07 20:55:06
|
Revision: 10982 http://octave.svn.sourceforge.net/octave/?rev=10982&view=rev Author: prnienhuis Date: 2012-09-07 20:54:56 +0000 (Fri, 07 Sep 2012) Log Message: ----------- Unintended auto-indenting fixed Modified Paths: -------------- trunk/octave-forge/main/io/INDEX trunk/octave-forge/main/io/NEWS trunk/octave-forge/main/io/PKG_ADD trunk/octave-forge/main/io/PKG_DEL trunk/octave-forge/main/io/doc/READ-ODS.html trunk/octave-forge/main/io/doc/READ-XLS.html trunk/octave-forge/main/io/inst/calccelladdress.m trunk/octave-forge/main/io/inst/chk_spreadsheet_support.m trunk/octave-forge/main/io/inst/getusedrange.m trunk/octave-forge/main/io/inst/io_ods_testscript.m trunk/octave-forge/main/io/inst/io_xls_testscript.m trunk/octave-forge/main/io/inst/object2json.m trunk/octave-forge/main/io/inst/oct2ods.m trunk/octave-forge/main/io/inst/oct2xls.m trunk/octave-forge/main/io/inst/ods2oct.m trunk/octave-forge/main/io/inst/odsclose.m trunk/octave-forge/main/io/inst/odsfinfo.m trunk/octave-forge/main/io/inst/odsopen.m trunk/octave-forge/main/io/inst/odsread.m trunk/octave-forge/main/io/inst/odswrite.m trunk/octave-forge/main/io/inst/parse_sp_range.m trunk/octave-forge/main/io/inst/parsecell.m trunk/octave-forge/main/io/inst/pch2mat.m trunk/octave-forge/main/io/inst/spsh_chkrange.m trunk/octave-forge/main/io/inst/spsh_prstype.m trunk/octave-forge/main/io/inst/xls2oct.m trunk/octave-forge/main/io/inst/xlsclose.m trunk/octave-forge/main/io/inst/xlsfinfo.m trunk/octave-forge/main/io/inst/xlswrite.m trunk/octave-forge/main/io/src/cell2csv.cc trunk/octave-forge/main/io/src/csv2cell.cc trunk/octave-forge/main/io/src/csvconcat.cc trunk/octave-forge/main/io/src/csvexplode.cc trunk/octave-forge/main/io/src/xmlread.cc trunk/octave-forge/main/io/src/xmltree.c trunk/octave-forge/main/io/src/xmltree.h trunk/octave-forge/main/io/src/xmltree_read.c trunk/octave-forge/main/io/src/xmltree_read.h Modified: trunk/octave-forge/main/io/INDEX =================================================================== --- trunk/octave-forge/main/io/INDEX 2012-09-07 15:44:24 UTC (rev 10981) +++ trunk/octave-forge/main/io/INDEX 2012-09-07 20:54:56 UTC (rev 10982) @@ -1,45 +1,44 @@ io >> Input from and output to external formats - File I/O - append_save - fexist - Miscellaneous conversion functions - object2json - pch2mat - CSV file functions - csv2cell - csvconcat - csvexplode - cell2csv - XML I/O - xmlread - xmlwrite - Spreadsheet I/O user functions for MS-Excel - oct2xls - xls2oct - xlsclose - xlsfinfo - xlsopen - xlsread - xlswrite - Spreadsheet I/O user functions for OpenOffice.org Calc - oct2ods - ods2oct - odsclose - odsfinfo - odsopen - odsread - odswrite - Spreadsheet utility functions - calccelladdress - chk_spreadsheet_support - parsecell - Spreadsheet I/O internal functions - getusedrange - parse_sp_range - spsh_chkrange - spsh_prstype - Spreadsheet function test scripts - io_xls_testscript - io_ods_testscript - - \ No newline at end of file +File I/O + append_save + fexist +Miscellaneous conversion functions + object2json + pch2mat +CSV file functions + csv2cell + csvconcat + csvexplode + cell2csv +XML I/O + xmlread + xmlwrite +Spreadsheet I/O user functions for MS-Excel + oct2xls + xls2oct + xlsclose + xlsfinfo + xlsopen + xlsread + xlswrite +Spreadsheet I/O user functions for OpenOffice.org Calc + oct2ods + ods2oct + odsclose + odsfinfo + odsopen + odsread + odswrite +Spreadsheet utility functions + calccelladdress + chk_spreadsheet_support + parsecell +Spreadsheet I/O internal functions + getusedrange + parse_sp_range + spsh_chkrange + spsh_prstype +Spreadsheet function test scripts + io_xls_testscript + io_ods_testscript + Modified: trunk/octave-forge/main/io/NEWS =================================================================== --- trunk/octave-forge/main/io/NEWS 2012-09-07 15:44:24 UTC (rev 10981) +++ trunk/octave-forge/main/io/NEWS 2012-09-07 20:54:56 UTC (rev 10982) @@ -1,147 +1,146 @@ Summary of important user-visible changes for releases of the io package - - =============================================================================== - io-1.0.20 Release Date: 2012-09-07 Release Manager: Philip Nienhuis - =============================================================================== - - ** Bug fixes: - --- xlsopen, xlsclose, odsopen, odsclose: replaced canonicalize_file_name call - with make_absolute_filename for non-windows systems (canonicalize_file_name - doesn't work with non-existent (new) files on *nix) (bug #36677); - Web addresses (URLs) only need two rather than three slashes; - --- xlsopen: matching .jar names to javaclasspath entries worked the wrong way - --- io_xls_testscript / io_ods_testscript: added small delay for UNO calls to - avoid lock-ups with recent LibreOffice (3.6.x) - - ** The annoying flashing LibreOffice splash screens have been fixed upstream; - with LibreOffice 3.6.1 I didn't see them anymore - - ** Extended file rename section in odsclose similar to that in xlsclose - - =============================================================================== - io-1.0.19 Release Date: 2012-06-08 Release Manager: Philip Nienhuis - =============================================================================== - - ** Bug fixes: - --- getusedrange subfunc getusedrange_jod: str2num applied to indices rather - than the substring. Must have been there for > 2 years, only surfaced - with jopendocument v 1.3b1 - --- oct2xls, oct2ods: cast all numeric types in input array to double as - spreadsheets have only double, boolean or character string type. This bug - has been there from the very beginning of the spreadsheet functions >8-O - - --- Support for reading back formulas from .xls spreadsheets using ActiveX/COM - - ** Compatible with jOpenDocument version 1.3b1 - getUsedRange() method added (MUCH faster than the old hack) - - ** Compatible with odfdom-java-0.8.8-incubator.jar (ODF Toolkit 0.5-incubating) - - ** Compatible with Apache POI 3.8 final - - =============================================================================== - io-1.0.18 Release Date: 2012-03-22 Release Manager: Philip Nienhuis - =============================================================================== - - ** The following functions have been imported from the miscellaneous package: - cell2csv csvconcat xmlread - csv2cell csvexplode xmlwrite - Their error messages and help messages have been cleaned up a bit. - - ** Bug fixes: - --- odsfinfo: fixed "wrong type argument `cell'" bug when run interactively. - --- xlsopen, odsopen: fixed messed up screen output due to UNO usage warning. - --- csv2cell: checks if file is empty and if so, return an empty cell. - --- xlsopen: better Java detection logic, more informative error messages - - ** Adapted to internal LibreOffice-3.5-final changes. - Some bugs (flashing LO screens) still have to be fixed upstream - see here: - https://bugs.freedesktop.org/show_bug.cgi?id=42470 - - ** Tried OpenXLS-6.0.7.jar. Reads OK, still unusable for writing .xls files. - - =============================================================================== - io-1.0.17 Release Date: 2012-02-27 Release Manager: Philip Nienhuis - =============================================================================== - - ** Bug fixes: - --- oct2ods, oct2xls, odswrite default range input arg. These functions may not - have worked properly for two years (!) - - ** Fixed support for odfdom v.0.8.7 (ODS). Note: the OTK interface only works - well with xercesImpl.jar 2.9.1 (Sep 14, 2009) - - ** Many small bug fixes & documentation updated to actual functionality. - - ** Fixed "seealso" texinfo header string in almost all functions. - - ** Added formal test scripts to "internal functions" section. - - =============================================================================== - io-1.0.16 Release Date: 2012-01-19 Release Manager: Philip Nienhuis - =============================================================================== - - ** Bug fixing release - - ** PKG_ADD now expects Java spreadsheet class libs (.jars) in /lib/java - (for MinGW) - - =============================================================================== - io-1.0.15 Release Date: 2011-10-02 Release Manager: Philip Nienhuis - =============================================================================== - - io-1.0.15 is primarily a bug fix release and a snapshot / wrap-up of current - development status (some still a bit experimental). It mainly comprises: - - ** A number of bug fixes (incl. some serious ones, notably with .ods/OOo Calc); - - ** Some mainly cosmetic improvements to existing code; less verbosity; - - ** pch2mat (reading & transforming Nastran PCH files, contributed by - B. Oytun Peksel); - - ** object2json.m (creating a json description string of objects, contributed - by Daniel Torre). This was already silently introduced in io-1.0.14; - - ** A scripted troubleshooting / classpath setup tool for spreadsheet I/O - support (chk_spreadsheet_support.m); - - ** Experimental OXS support (OpenXLS) for reading Excel xls (BIFF8). - OpenXLS is -let's say- a little bit lacking: For reading it is faster than - JXL. However, while OXS write support has been coded (and works) I had to - disable it as the OXS Java classes won't release the file handle so Octave - will hang upon closing :-( I'm stuck with this so I just release it as-is; - - ** Experimental UNO support, i.e. invoking OpenOffice.org (or clones like - LibreOffice) behind the scenes to read spreadsheet files, much like - ActiveX/COM for MS-Excel. This is also based on Java. The first time you - use UNO, OOo has to be loaded and you'll have to be patient, but once loaded - (and in the OS cache) you'll see the pros: - --* Very fast; - --* Much lower Java memory usage as OOo loads the spreadsheet in its own - memory chunk (not Octave's) => much bigger spreadsheet capacity; - --* You can read *all* formats supported by OOo: .ods, .xls, .csv, .xlsx, - .sxc, .dbf, Lotus wk1, Quattro Pro, ......; and it doesn't really matter - whether xlsopen of odsopen is used. - Of course all this wonderful stuff comes at a prize: - --* After closing the spreadsheet file (odsclose, xlsclose) ALL OOo - invocations will be closed, also those started outside Octave. This is - due to "the way OpenOffice works" (quoted from OOo dev forum), especially - through Java. There are other ways to close OOo but they'll hang Octave; - --* The Java UNO classes supplied with e.g. LibreOffice aren't kept quite - up-to-date with the main program. As a consequence, with e.g., - LibreOffice 3.4 the main LO window will pop up (it can't be hidden). I - filed a bug report for this - (https://bugs.freedesktop.org/show_bug.cgi?id=40991) but I haven't seen - it being picked up yet. Another example: while LO 3.3.1's row capacity - was already > 10^6, it took until LO 3.4 before this capacity was - implemented in the Java UNO classes. - Like with OXS, I'm a bit stuck here - all this has to be fixed upstream. - - Hint: - for older Octave versions (< 3.4.0) you can install io-1.0.15 using the -nodeps - flag. You'll then loose the old and buggy textread and csv/dlm-read/write - functions but I'd consider that as no big loss. - - <please scroll up/back to see rest of io NEWS> - \ No newline at end of file + +=============================================================================== +io-1.0.20 Release Date: 2012-09-07 Release Manager: Philip Nienhuis +=============================================================================== + +** Bug fixes: +--- xlsopen, xlsclose, odsopen, odsclose: replaced canonicalize_file_name call + with make_absolute_filename for non-windows systems (canonicalize_file_name + doesn't work with non-existent (new) files on *nix) (bug #36677); + Web addresses (URLs) only need two rather than three slashes; +--- xlsopen: matching .jar names to javaclasspath entries worked the wrong way +--- io_xls_testscript / io_ods_testscript: added small delay for UNO calls to + avoid lock-ups with recent LibreOffice (3.6.x) + +** The annoying flashing LibreOffice splash screens have been fixed upstream; + with LibreOffice 3.6.1 I didn't see them anymore + +** Extended file rename section in odsclose similar to that in xlsclose + +=============================================================================== +io-1.0.19 Release Date: 2012-06-08 Release Manager: Philip Nienhuis +=============================================================================== + +** Bug fixes: +--- getusedrange subfunc getusedrange_jod: str2num applied to indices rather + than the substring. Must have been there for > 2 years, only surfaced + with jopendocument v 1.3b1 +--- oct2xls, oct2ods: cast all numeric types in input array to double as + spreadsheets have only double, boolean or character string type. This bug + has been there from the very beginning of the spreadsheet functions >8-O + +--- Support for reading back formulas from .xls spreadsheets using ActiveX/COM + +** Compatible with jOpenDocument version 1.3b1 + getUsedRange() method added (MUCH faster than the old hack) + +** Compatible with odfdom-java-0.8.8-incubator.jar (ODF Toolkit 0.5-incubating) + +** Compatible with Apache POI 3.8 final + +=============================================================================== +io-1.0.18 Release Date: 2012-03-22 Release Manager: Philip Nienhuis +=============================================================================== + +** The following functions have been imported from the miscellaneous package: + cell2csv csvconcat xmlread + csv2cell csvexplode xmlwrite + Their error messages and help messages have been cleaned up a bit. + +** Bug fixes: +--- odsfinfo: fixed "wrong type argument `cell'" bug when run interactively. +--- xlsopen, odsopen: fixed messed up screen output due to UNO usage warning. +--- csv2cell: checks if file is empty and if so, return an empty cell. +--- xlsopen: better Java detection logic, more informative error messages + +** Adapted to internal LibreOffice-3.5-final changes. + Some bugs (flashing LO screens) still have to be fixed upstream - see here: + https://bugs.freedesktop.org/show_bug.cgi?id=42470 + +** Tried OpenXLS-6.0.7.jar. Reads OK, still unusable for writing .xls files. + +=============================================================================== +io-1.0.17 Release Date: 2012-02-27 Release Manager: Philip Nienhuis +=============================================================================== + +** Bug fixes: +--- oct2ods, oct2xls, odswrite default range input arg. These functions may not + have worked properly for two years (!) + +** Fixed support for odfdom v.0.8.7 (ODS). Note: the OTK interface only works + well with xercesImpl.jar 2.9.1 (Sep 14, 2009) + +** Many small bug fixes & documentation updated to actual functionality. + +** Fixed "seealso" texinfo header string in almost all functions. + +** Added formal test scripts to "internal functions" section. + +=============================================================================== +io-1.0.16 Release Date: 2012-01-19 Release Manager: Philip Nienhuis +=============================================================================== + +** Bug fixing release + +** PKG_ADD now expects Java spreadsheet class libs (.jars) in /lib/java + (for MinGW) + +=============================================================================== +io-1.0.15 Release Date: 2011-10-02 Release Manager: Philip Nienhuis +=============================================================================== + +io-1.0.15 is primarily a bug fix release and a snapshot / wrap-up of current + development status (some still a bit experimental). It mainly comprises: + +** A number of bug fixes (incl. some serious ones, notably with .ods/OOo Calc); + +** Some mainly cosmetic improvements to existing code; less verbosity; + +** pch2mat (reading & transforming Nastran PCH files, contributed by + B. Oytun Peksel); + +** object2json.m (creating a json description string of objects, contributed + by Daniel Torre). This was already silently introduced in io-1.0.14; + +** A scripted troubleshooting / classpath setup tool for spreadsheet I/O + support (chk_spreadsheet_support.m); + +** Experimental OXS support (OpenXLS) for reading Excel xls (BIFF8). + OpenXLS is -let's say- a little bit lacking: For reading it is faster than + JXL. However, while OXS write support has been coded (and works) I had to + disable it as the OXS Java classes won't release the file handle so Octave + will hang upon closing :-( I'm stuck with this so I just release it as-is; + +** Experimental UNO support, i.e. invoking OpenOffice.org (or clones like + LibreOffice) behind the scenes to read spreadsheet files, much like + ActiveX/COM for MS-Excel. This is also based on Java. The first time you + use UNO, OOo has to be loaded and you'll have to be patient, but once loaded + (and in the OS cache) you'll see the pros: + --* Very fast; + --* Much lower Java memory usage as OOo loads the spreadsheet in its own + memory chunk (not Octave's) => much bigger spreadsheet capacity; + --* You can read *all* formats supported by OOo: .ods, .xls, .csv, .xlsx, + .sxc, .dbf, Lotus wk1, Quattro Pro, ......; and it doesn't really matter + whether xlsopen of odsopen is used. + Of course all this wonderful stuff comes at a prize: + --* After closing the spreadsheet file (odsclose, xlsclose) ALL OOo + invocations will be closed, also those started outside Octave. This is + due to "the way OpenOffice works" (quoted from OOo dev forum), especially + through Java. There are other ways to close OOo but they'll hang Octave; + --* The Java UNO classes supplied with e.g. LibreOffice aren't kept quite + up-to-date with the main program. As a consequence, with e.g., + LibreOffice 3.4 the main LO window will pop up (it can't be hidden). I + filed a bug report for this + (https://bugs.freedesktop.org/show_bug.cgi?id=40991) but I haven't seen + it being picked up yet. Another example: while LO 3.3.1's row capacity + was already > 10^6, it took until LO 3.4 before this capacity was + implemented in the Java UNO classes. + Like with OXS, I'm a bit stuck here - all this has to be fixed upstream. + +Hint: +for older Octave versions (< 3.4.0) you can install io-1.0.15 using the -nodeps + flag. You'll then loose the old and buggy textread and csv/dlm-read/write + functions but I'd consider that as no big loss. + + <please scroll up/back to see rest of io NEWS> Modified: trunk/octave-forge/main/io/PKG_ADD =================================================================== --- trunk/octave-forge/main/io/PKG_ADD 2012-09-07 15:44:24 UTC (rev 10981) +++ trunk/octave-forge/main/io/PKG_ADD 2012-09-07 20:54:56 UTC (rev 10982) @@ -1,16 +1,16 @@ ## PKG_ADD - ## add paths of io pkg java jars if java pkg is installed and loaded - pkglist = pkg ("list"); - javapkgind = find (cellfun (@(x) strcmp(x.name, "java"), pkglist), 1, "first"); - if (! isempty (javapkgind)) - javapkg = pkglist{javapkgind}; - if (javapkg.loaded) - # Assume jar files are in /lib/java and let chk_spreadsheet_support sort it out - libdir = octave_config_info ("libdir"); - ## Allow time for package to be fully loaded - pause (0.25); - spr_status = chk_spreadsheet_support ([ libdir filesep "java" ]); - endif - endif - ## Clean up - clear javapkgind javapkg libdir spr_status pkglist ; \ No newline at end of file +## add paths of io pkg java jars if java pkg is installed and loaded +pkglist = pkg ("list"); +javapkgind = find (cellfun (@(x) strcmp(x.name, "java"), pkglist), 1, "first"); +if (! isempty (javapkgind)) + javapkg = pkglist{javapkgind}; + if (javapkg.loaded) + # Assume jar files are in /lib/java and let chk_spreadsheet_support sort it out + libdir = octave_config_info ("libdir"); + ## Allow time for package to be fully loaded + pause (0.25); + spr_status = chk_spreadsheet_support ([ libdir filesep "java" ]); + endif +endif +## Clean up +clear javapkgind javapkg libdir spr_status pkglist ; \ No newline at end of file Modified: trunk/octave-forge/main/io/PKG_DEL =================================================================== --- trunk/octave-forge/main/io/PKG_DEL 2012-09-07 15:44:24 UTC (rev 10981) +++ trunk/octave-forge/main/io/PKG_DEL 2012-09-07 20:54:56 UTC (rev 10982) @@ -1,8 +1,7 @@ ## PKG_DEL - ## - ## Below are base names of spreadsheet I/O Java class libs. - ## They'll stay (harmless) in the javaclasspath until termination of the current Octave session. - ## {'poi-3', 'poi-ooxml-3', xbean', 'poi-ooxml-schemas', 'dom4j-1.6.1', 'jxl', 'openxls', ... - ## 'odfdom', 'xercesImpl', 'jopendocument', ... - ## 'program', 'unoil', 'jurt', 'juh', 'unoloader', 'ridl'} - \ No newline at end of file +## +## Below are base names of spreadsheet I/O Java class libs. +## They'll stay (harmless) in the javaclasspath until termination of the current Octave session. +## {'poi-3', 'poi-ooxml-3', xbean', 'poi-ooxml-schemas', 'dom4j-1.6.1', 'jxl', 'openxls', ... +## 'odfdom', 'xercesImpl', 'jopendocument', ... +## 'program', 'unoil', 'jurt', 'juh', 'unoloader', 'ridl'} Modified: trunk/octave-forge/main/io/doc/READ-ODS.html =================================================================== --- trunk/octave-forge/main/io/doc/READ-ODS.html 2012-09-07 15:44:24 UTC (rev 10981) +++ trunk/octave-forge/main/io/doc/READ-ODS.html 2012-09-07 20:54:56 UTC (rev 10982) @@ -170,8 +170,7 @@ <b>odsopen</b> / <b>ods2oct</b> / \x85 / <b>oct2ods</b> / \x85. / <b>odsclose</b>, <b><u><i>DO NOT FORGET</i></u></b> to invoke <b>odsclose</b> in the end. The file pointers can contain an enormous amount of data and - may needlessly keep precious memory allocated. In case of the UNO interface, the - hidden OpenOffice.org invocation (soffice.bin) can even block proper closing of + may needlessly keep precious memory allocated. In case of the UNO interface, the hidden OpenOffice.org invocation (soffice.bin) can even block proper closing of Octave.</font></font></p></dt><dt><br> </dt></dl> <p align="center"><font face="Arial, sans-serif"><font size="4"><u><b>SPREADSHEET Modified: trunk/octave-forge/main/io/doc/READ-XLS.html =================================================================== --- trunk/octave-forge/main/io/doc/READ-XLS.html 2012-09-07 15:44:24 UTC (rev 10981) +++ trunk/octave-forge/main/io/doc/READ-XLS.html 2012-09-07 20:54:56 UTC (rev 10982) @@ -1,333 +1,332 @@ <HTML> - <HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252"> - <META NAME="Generator" CONTENT="Microsoft Word 97"> - <META NAME="CREATED" CONTENT="20091211;17230700"> - <META NAME="CHANGEDBY" CONTENT="Philip Nienhuis"> - <META NAME="CHANGED" CONTENT="20120226;18083900"> - </HEAD> - <BODY LINK="#0000ff" VLINK="#800080"> - - <P><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"></P> - <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><P ALIGN="CENTER">README for Excel spreadsheet file r/w access scripts for octave (> 3.4.0)<BR> - <BR> - Copyright (C) 2009 - 2012 Philip Nienhuis <prnienhuis at users.sf.net><BR> - <BR> - This version September 7, 2012</P> - </FONT></FONT><B><U><FONT FACE="Arial, sans-serif" SIZE=4><FONT FACE="Arial, sans-serif" SIZE=4><P ALIGN="CENTER">EXCEL .XLS SUPPORT FILES</P> - </B></U></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DT><BR> - <B>doc/README-XLS.html</B><BR> - This file.</FONT></FONT> </DT><BR> - <B><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DT>xlsread.m</DT> - </B><DT>All-in-one function for reading data from one specific worksheet in an Excel spreadsheet file. This script has Matlab-compatible functionality. <BR> - </DT><BR> - <B>xlswrite.m</B> - <DT>All-in-one function for writing data to one specific worksheet in an Excel spreadsheet file. This script has Matlab-compatible functionality.<BR> - <BR> - <B>xlsfinfo.m</B> - <DT>All-in-one function for exploring basic properties of an Excel spreadsheet file. This script has Matlab-compatible functionality. <BR> - <BR> - <B>xlsopen.m</B></DT> - <DT>Function for "opening" (= providing a handle to) an Excel spreadsheet file ("workbook"). This function sorts out which interface to use for .xls access (i.e.,COM; Java & Apache POI; JexcelAPI; OpenXLS; etc.), but it's choice can be overridden. <BR> - <BR> - <B>xls2oct.m</B></DT> - <DT>Function for reading data from a specific worksheet pointed to in a struct created by xlsopen.m. xls2oct can be called multiple times consecutively using the same pointer struct, each time allowing to read data from different ranges and/or worksheets. Data are returned in the form of a 2D heterogeneous cell array that can be parsed by parsecell.m. xls2oct is a mere wrapper for interface-dependent scripts that do the actual low-level reading. <BR> - <BR> - <B>oct2xls.m</B></DT> - <DT>Function for writing data to a specific worksheet pointed to in a struct created by xlsopen.m. octxls can be called multiple times consecutively using the same pointer struct, each time allowing to write data to different ranges and/or worksheets. oct2xls is a mere wrapper for interface-dependent scripts that do the actual low-level writing. <BR> - <BR> - <B>xlsclose.m</B></DT> - <DT>Function for closing (the handle to) an Excel workbook. When data have been written to the workbook oct2xls will write the workbook to disk. Otherwise, the file pointer is simply closed and possibly used interfaces for Excel access (COM/ActiveX/Excel.exe) will be shut down properly. <BR> - <BR> - <B>parsecell.m</B></DT> - <DT>Function for separating the data in raw arrays returned by xls2oct, into numerical/logical and text (cell) arrays. <BR> - <BR> - <B>chk_spreadsheet_support.m</B></DT> - <DT>Internal function for (1) checking, (2) setting up, (3) debugging spreadsheet support. While not specifically meant for direct invocation from the Octave prompt (it is more useful during initialization of Octave itself) it can be very helpful when hunting down issues with spreadsheet support in Octave.</DT> - </DL> - <B>spsh_chkrange.m</B>,</FONT></FONT> <B><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>spsh_prstype.m</B>,</FONT></FONT> <B><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>getusedrange.m</B>,</FONT></FONT> <B><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>calccelladdress.m</B>,</FONT></FONT> <B><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>parse_sp_range.m - </B> - <DT>Support files called by the scripts and not meant for direct invocation by users.<BR></DT> - <BR> - <DT><B>io_xls_testscript.m</B></DT> - <DT>Script for testing basic features of the spreadsheet scripts.</DT> - </DL> - <P ALIGN="CENTER"><BR> - </FONT></FONT><B><U><FONT FACE="Arial, sans-serif" SIZE=4><FONT FACE="Arial, sans-serif" SIZE=4>REQUIRED SUPPORT SOFTWARE</P> - </B></U></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DT><BR> - For the Excel/COM interface:</DT> - </DL> - - <UL> - <LI>A windows computer with Excel installed</LI> - <LI>Octave-forge Windows-1.0.8 (WITH LATEST SVN PATCHES APPLIED) or later package (preferrably 1.1.10 or later)</LI></UL> - - <P>For the Java / Apache POI / JExcelAPI interfaces (general):</FONT></FONT> </P> - - <UL> - <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><LI>octave-forge java-1.2.8 package or later version on Linux</LI> - <LI>octave-forge java-1.2.8 with latest svn fixes, or later version on Windows/MingW</LI> - <LI>Java JRE or JDK > 1.6.0 (hasn't been tested with earlier versions)</LI></UL> - - <DL> - <DT>Apache POI specific:</DT> - </DL> - - <UL> - <LI>class .jars: <B>poi-3.5-FINAL-<date>.jar</B> & <B>poi-ooxml-3.5-FINAL-<date>.jar</B> (or later versions) in classpath</LI> - <LI>Get it here: </FONT></FONT><A HREF="http://poi.apache.org/download.html"><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>http://poi.apache.org/download.html</FONT></FONT></A></LI></UL> - <DIR> - <DIR> - - <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><P>and here:</P></DIR> - </DIR> - - - <UL> - <LI>for OOXML support (only available with Apache POI): </LI></UL> - <DIR> - <DIR> - - <B><P>poi-ooxml-schemas-<version>.jar</B>, <B>xbean.jar</B>, <B>dom4j-1.6.1.jar</B> in javaclasspath. </P> - <P>Get them here:</P> - </FONT></FONT><P><A HREF="http://poi.apache.org/download.html"><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>http://poi.apache.org/download.html</FONT></FONT></A><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2> ("xmlbeans" and poi-ooxml-schemas)</P> - </FONT></FONT><P><A HREF="http://sourceforge.net/projects/dom4j/files"><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>http://sourceforge.net/projects/dom4j/files</FONT></FONT></A><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2> (dom4j-<version>)</P></DIR> - </DIR> - - <DL> - <DT>JExcelAPI specific:</DT> - </DL> - - <UL> - <LI>class .jar: <B>jxl.jar</B> in classpath</LI> - <LI>Get it here: </FONT></FONT><A HREF="http://sourceforge.net/projects/jexcelapi/files/"><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>http://sourceforge.net/projects/jexcelapi/files/</FONT></FONT></A></LI></UL> - - <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DT>OpenXLS specific:</DT> - </DL> - - <UL> - <LI>class .jar: <B>jxl.jar</B> in classpath</LI> - <LI>Get it here: </FONT></FONT><A HREF="http://sourceforge.net/projects/openxls/"><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>http://sourceforge.net/projects/openxls/</FONT></FONT></A></LI></UL> - - <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DT>These class libs must be referenced with full pathnames in your javaclasspath.<br>They had best be put in /<libdir>/java where <libdir> on Linux is usually /usr/lib; on MinGW it is usually /lib. The PKG_ADD command expects the class libs there; if they are elsewhere, add them in ./share/octave/<version>/m/startup/octaverc using appropriate javaaddpath statements or a chk_spreadsheet_support() call.</DT></DL> - <DL><DT>UNO specific (invoking OpenOffice.org (or clones) behind the scenes):<BR> - NOTE: EXPERIMENTAL!! A working OpenOffice.org installation. The utility function chk_spreadsheet_support can be used to add the needed entries to the javaclasspath.<BR></DT> - </DL> - <P ALIGN="CENTER"><BR> - </FONT></FONT><B><U><FONT FACE="Arial, sans-serif" SIZE=4><FONT FACE="Arial, sans-serif" SIZE=4>USAGE</P> - </B></U></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DT><BR> - <B>xlsread</B> and <B>xlswrite</B> are mere wrappers for <B>xlsopen</B>-<B>xls2oct</B>-<B>xlsclose</B>-<B>parsecell</B> and <B>xlsopen</B>-<B>oct2xls</B>-<B>xlsclose</B> sequences, resp. They exist for the sake of Matlab compatibility.<BR> - <BR> - <B>xlsfinf</B>o can be used for finding out what worksheet names exist in the file. For OOXML files you either need MS-Excel 2007 for Windows (or later version) installed, and/or the input parameter REQINTF should be specified with a value of 'poi' (case-insensitive) and -obviously- the complete POI interface must have been installed.<BR> - <BR> - Invoking <B>xlsopen</B>/..../<B>xlsclose</B> directly provides for much more flexibility, speed, and robustness than <B>xlsread</B> / <B>xlswrite</B>. Indeed, using the same file handle (pointer struct) you can mix reading & writing before writing the workbook out to disk using xlsclose.<BR> - And: <B>xlsopen </B>/ <B>xlsclose</B> hide the gory interface details from the user.<BR> - Currently only .xls files (BIFF8) can be read/written; using JExcelAPI BIFF5 can be read as well. For OOXML files either Excel 2007 for Windows (or higher) and/or the complete Apache POI interface must be installed (and probably the REQINTF parameter specified with a value of 'poi').<BR> - <BR> - When using <B>xlsopen</B>....<B>xlsclose</B> be sure to keep track of the file handle struct.<BR> - <BR> - A possible scenario:<BR> - <BR> - <B>xlh = xlsopen (<excel_filename> , [rw], [<requested interface>])</B><BR> - <I># Set rw to 1 if you want to write to a workbook immediately.<BR> - # In that case the check for file existence is skipped and<BR> - # -if needed- a new workbook created.<BR> - # If you really want an other interface than auto-selected<BR> - # by xlsopen you can request that. But xlsopen still checks<BR> - # proper support for your choice.</I><BR> - <BR> - <I># Read some data</I><BR> - <B>[ rawarr1, xlh ] = xls2oct (xlh, <SomeWorksheet>, <Range>)</B><BR> - <I># Be sure to specify xlh as output argument as xls2oct keeps<BR> - # track of changes and the need to write the workbook to disk <BR> - # in the xlhstruct. And the origin range is conveyed through<BR> - # the xlh pointer struct.</I><BR> - <BR> - <I># Separate data into numeric and text data</I><BR> - <B>[ numarr1, txtarr1, lim1 ] = parsecell (rawarr1)</B><BR> - <I><BR> - </I># Get more data from another worksheet in the same workbook<BR> - <B>[ rawarr2, xlh ] = xls2oct (xlh, <SomeOtherWorksheet>, <Range>)</B><BR> - <B>[ numarr2, txtarr2, lim2 ] = parsecell (rawarr2)</B><BR> - <BR> - # <... Analysis and preparation of new data in cell array Newdata....><BR> - <BR> - <I># Add new data to spreadsheet</I><BR> - <B>xlh = oct2xls (Newdata, xlh, <AnotherWorksheet>, <Range>)</B><BR> - <BR> - <I># Close the workbook and write it to disk; then clear the handle</I><BR> - <B>xlh = xlsclose (xlh)</B><BR> - <B>clear xlh</DT> - </B><DT>When not using the COM interface, specify a value of 'POI' for parameter REQINTF when accessing OOXML files in xlsread, xlswrite, xlsopen, xlsfinfo (and be sure the complete Apache POI interface is installed). If you haven't got ActiveX installed (i.e., not having MS-Excel under Windows) specifying 'POI' may not be needed as in such cases Apache POI is the next default interface.</DT> - <DT>When using JExcelAPI (JXL), after writing into a worksheet you MUST save the file \x96 adding data to the same or another worksheet is no more possible after the first call to oct2xls(). This is a limitation of JExcelAPI.</DT> - </DL> - </FONT></FONT><B><U><FONT FACE="Arial, sans-serif" SIZE=4><FONT FACE="Arial, sans-serif" SIZE=4><P ALIGN="CENTER">SPREADSHEET FORMULA SUPPORT</P> - </B></U></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DT><BR> - When using the COM, POI, JXL, and UNO interfaces you can:</DT> - </DL> - - <UL> - <LI>(When reading, xls2oct) either read evaluated spreadsheet formula results, or the literal formula text strings;</LI> - <LI>(When writing, oct2xls) either enter text strings in the form of spreadsheet formulas in the worksheet as formulas, or enter them as literal text strings.</LI></UL> - - <P>In short, you can enter spreadsheet formulas and in a later stage read them back, change them and re-enter them in the worksheet. </P> - <DL> - <DT>The behaviour is controlled by an option structure <B>options</B></FONT></FONT> <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>which for now has only one (logical) field:</DT> - <B><DT>options.formulas_as_text</B></FONT></FONT> <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>= 0 (the default) implies enter formulas as formulas and read back formula results</DT> - <B><DT>options.formulas_as_text </B>=1 (or any positive integer) means enter formulas as text strings and read them back as text strings.</DT> - <DT>Be aware that there's no formula evaluator in JExcelAPI (JXL). So if you create formulas in your spreadsheet using oct2xls or xlswrite with 'JXL', do not expect meaningful results when reading those files later on <B>unless</B></FONT></FONT> <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>you open them in Excel and write them back to disk.</DT> - <DT>While both Apache POI and JExcelAPI feature a formula validator, not all spreadsheet functions present in Excel have been implemented (yet).</DT> - <DT>Worse, older Excel versions feature less functions than newer versions. So be wary as this may make for interesting confusion.</DT> - </DL> - </FONT></FONT><B><U><FONT FACE="Arial, sans-serif" SIZE=4><FONT FACE="Arial, sans-serif" SIZE=4><P ALIGN="CENTER">MATLAB COMPATIBILITY</P> - </B></U></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DT><BR> - <B>xlsread</B>, <B>xlswrite</B> and <B>xlsfinfo</B> are for the most part Matlab-compatible. Some small differences are mentioned below. When using the Java interfaces octave supplies some formula manipulation support.<BR> - <BR> - <B><U>xlsread</B></U><BR> - Matlab's <B>xlsread</B> supports invoking extra functions while reading ("passing function handle"); octave not. But this can be simulated outside <B>xlsread</B>.<BR> - <BR> - Matlab's <B>xlsread</B> flags some spreadsheet errors, octave-forge just returns blank cells.<BR> - <BR> - Octave's xlsread returns info about the actual (rather than the requested) cell range where the data came from. Personally I find it very useful to know from what part of a worksheet the data originate so I've put quite some effort in it :-)</DT> - <DT>Matlab can't, due to Excel automatically trimming returned arrays from empty outer columns and rows. Octave is more clever but the Visual Basic call used for determining the actually used range has some limitations: (1) it relies on cached range values and thus may be out-of-date, and (2) it counts empty formatted cells too. When using ActiveX/COM, if octave's <B>xlsfinfo</B>.m returns wrong data ranges it is most often an overestimation.</DT> - <DT>Matlab's <B>xlsread</B> ignores all non-numeric data values outside the smallest rectangle encompassing all numerical values. Octave's <B>xlsread</B> doesn't. This means that Matlab ignores all row/column headers, not very user-friendly IMO. <BR> - <BR> - When using the Java interface, reading and writing xls-files by octave's xlsread is platform-independent. On systems w/o installed Excel, Matlab can only read Excel 95 formatted .xls files (written using ML <B>xlswrite</B>'s 'Basic" option) \x96 and then differently than under Windows.....</DT> - <DT>Matlab's <B>xlsread</B> returns strings for cells containing date values. This makes for endless if-then-elseif-else-end constructs to catch all expected date formates. Octave returns numerical data (where 0 = 1/1/1900 \x96 you can easily transfer them into proper octave date values yourself using e.g. datestr(), see bottom of this document for more info).<BR> - <BR> - Matlab's <B>xlsread</B> invokes <B>csvread</B> if no Excel interface is present. Octave's <B>xlsread</B> doesn't.<BR> - <BR> - <B><U>xlswrite</B></U><BR> - Octave's <B>xlswrite</B> works on systems w/o Excel support, Matlab's doesn't (properly).</DT> - <DT>When specifying a sheet number larger than the number of existing sheets in an .xls file, Matlab's <B>xlswrite</B> adds empty sheets until the new sheet number is created; Octave's <B>xlswrite</B> only adds one sheet called "Sheet<number>" where <number> is the specified sheet number. </DT> - <DT>Even better (IMO) while M's <B>xlswrite</B> always creates Sheet1/Sheet2/Sheet3 when creating a new spreadsheet, octave's <B>xlswrite</B> only creates the requested worksheet. (Did you know that you can instruct Excel to create spreadsheets with just one, or any number of, worksheets? Look in Tools | Options, General tab.)</DT> - <DT>Oh and octave doesn't touch the "active sheet" - but that's not automatically an advantage.</DT> - <DT>If the specified write range is larger than the actual data array, Matlab's <B>xlswrite</B> adds #N/A cells to fill up the lowermost rows and rightmost columns; octave-forge's <B>xlswrite</B> doesn't. <BR> - <BR> - <B>xlsfinfo</B><BR> - When invoking Excel/COM interface, octave's <B>xlsfinfo</B> also echoes the type of sheet (worksheet, chart), not just the sheet names. Using Java I haven't found similar functionality (yet).</DT> - </DL> - </FONT></FONT><B><U><FONT FACE="Arial, sans-serif" SIZE=4><FONT FACE="Arial, sans-serif" SIZE=4><P ALIGN="CENTER">COMPARISON OF INTERFACES & USAGE</P> - </B></U></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DT>Using Excel itself (through <b>COM / ActiveX</b> on Windows systems) is probably the most robust and versatile and especially FAST option. There's one gotcha: in case of some type of COM errors Excel will keep running invisibly; you can only end it through Task Manager. <BR> - A tiny problem is that one cannot find out easily through COM what file types are supported; xls, wks, wk1, xlsx, etc. <BR> - Another -obvious- limitation is that COM Excel access only works on Windows systems where Excel is installed. <BR> - <BR> - <b>JExcelAPI</b> (Java-based and therefore platform-independent) is proven technology but switching between reading and writing is quite involved and memory-hungry when processing large spreadsheets. As the docs state, JExcelAPI is optimized for reading and it does do that well - but still slower than Excel/COM. The fact that upon a switch from reading to writing the existing spreadsheet is overwritten <B>in place</B> by a blank one and that you can only get the contents back wen writing out all of the changes is worrying - and any change after the first write() is lost as a next write() doesn't seem to work, worse yet, you may completely loose the spreadsheet in question. The first is by JExcelAPI design, the second is probably a bug (in octave-forge/Java or JExcelAPI ? I don't know). Adding data to existing spreadsheets does work, but IMO undue user confidence is needed.</DT> - <DT>JExcelAPI supports BIFF5 (only reading) and BIFF8 (Excel 95 and Excel 97-2003, respectively). Upon overwriting, BIFF5 spreadsheets are converted silently to BIFF8.</DT> - <DT>JexcelAPI, unlike ApachePOI, doesn't evaluate functions while reading but instead relies on cached results (i.e. results computed by Excel itself). Depending on Excel settings ("Automatic calculation" ON or OFF) this may or may not yield incorrect (or expected) results. <BR> - <BR> - <b>Apache POI</b> (Java-based and platform-independent too) is based on the OpenOffice.org I/O Excel r/w routines. It is a more versatile than JExcelAPI, while it doesn't support BIFF5 it does support BIFF8 (Excel 97 \x96 2003) and OOXML (Excel 2007).</DT> - <DT>It is slower than native JXL let alone Excel & COM but it features active formula evaluation, although at the moment (v. 3.8) still not all Excel functions have been implemented. I've made the relevant subfunction (xls2jpoi2oct) fall back to cached formula results (and yield a suitable warning) for non-implemented Excel functions while reading Excel files. <BR> - <BR> - <b>OpenXLS</b> (an open source version of Extentech's commercial Java-xls product) is still experimental. It seems to work faster than JExcelAPI, but it has other issues - i.e., it locks the .xls file and the unlocking mechanism is a bit wonky. Sometimes xls files keep being locked until Octave is shut down. Currently OXS write support is disabled (but the code is there). OpenXLS doesn't support reading back formulas as text strings.<BR> - <BR> - <b>UNO</b> (invoking OpenOffice.org or clones behind the scenes, a la ActiveX) is experimental. It works FAST (i.e., once OOo itself is loaded which can take some time) and can process much larger spreadsheets than the other Java-based interfaces because the data are not entered in the JVM but in OOo's memory.<BR> - A big stumbling block is that odsclose() on a UNO xls struct will kill ALL OpenOffice.org invocations, also those that were not related to Octave! This is due to UNO-Java limitations.<br> - The underlying issue is that when Octave starts an OpenOffice.org invocation, OpenOffice.org must be closed for Octave to be able to exit; otherwise Octave will wait for OOo to shut down before it can terminate itself. So Octave must kill OOo to be able to terminate.<br> - A way out hasn't been found yet.<br><br> - All in all, of the three Java options I'd prefer Apache POI rather than OpenXLS or JexcelAPI. But the latter is indispensable for BIFF5 formats. Once UNO is stable it is to be preferred as it can read ALL file formats supported by OOo (viz. wk1, ods, xlsx, sxc, ...)</DT> - <DT><br>Some notes on the choice for Java:</DT> - </DL> - <OL> - - <LI>It saves a LOT of development time to use ready-baked Java classes rather than developing your own routines and thus effectively reinvent the wheel.</LI> - <LI>A BIG advantage is that a Java-based solution is platform-independent ("portable").</LI> - <LI>But Java is known to be not very conservative with resources, especially not when processing XML-based formats.</LI></OL> - - <DL> - <DT>So Java is a compromise between portability and rapid development time versus capacity (and speed).</DT> - <DT>But IMO data sets larger than 5.10<SUP>5</SUP> cells should not be kept in spreadsheets anyway. Better use real databases for such data sets.</DT> - </DL> - </FONT></FONT><B><U><FONT FACE="Arial, sans-serif" SIZE=4><FONT FACE="Arial, sans-serif" SIZE=4><P ALIGN="CENTER">A NOTE ON JAVA MEMORY USAGE</P> - </U></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><P>Java memory pool allocation size</P> - </B><DL> - <DT>The Java virtual machine (JVM), when initialized by octave, reserves one big chunk of your computer's RAM in which all java classes and methods etc. are to be loaded: the java memory pool. It does this because java has a very sophisticated "garbage collection" system. At least on Windows, the initial size is 2MB and the maximum size is 16 MB. On Linux this allocated size might differ (e.g., my Mandriva box with openJDK has a 512 MB default max setting). This part of memory is where the Java-based XLS/ODS octave routines live and keep their variables etc.</DT> - <DT>For transferring large pieces of information to and from spreadsheets you might hit the limits of this pool. E.g. to be able to handle I/O of an array of around 500,000 cells I needed a memory pool size of 512 MB.</DT> - <DT>The memory size can be increased by inserting a file called "java.opts" (without quotes) in the directory ./share/octave/packages/java-<version> (where the script file javaclasspath.m is located), containing just the following lines:</DT> - </FONT></FONT><B><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2><DT>-Xms16m<BR> - -Xmx512m</DT> - </B></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DT>(where 16 = initial size, 512 = maximum size (in this example), m stands for Megabyte. This maximum is system-dependent. E.g., I have a 1 GB setting).</DT> - <DT>After processing a large chunk of spreadsheet information you might notice that octave's memory footprint does not shrink so it looks like Java's memory pool does not shrink back; but rest assured, the memory footprint is the <I>allocated</I> (reserved) memory size, not the actual used size. After the JVM has done its garbage collection, only the so-called "working set" of the memory allocation is really in use and that is a trimmed-down part of the memory allocation pool. On Windows systems it often suffices to minimize the octave terminal for a few seconds to get a more reasonable memory footprint.</DT> - </DL> - </FONT></FONT><B><U><FONT FACE="Arial, sans-serif" SIZE=4><FONT FACE="Arial, sans-serif" SIZE=4><P ALIGN="CENTER">TROUBLESHOOTING</P> - </B></U></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DT>Some hints for troubleshooting Excel support are contained in this thread:</DT> - </FONT></FONT><DT><A HREF="http://sourceforge.net/mailarchive/forum.php?thread_name=4C61B649.9090802%40hccnet.nl&forum_name=octave-dev"><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>http://sourceforge.net/mailarchive/forum.php?thread_name=4C61B649.9090802%40hccnet.nl&forum_name=octave-dev</FONT></FONT></A></DT> - <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DT>dated August 10, 2010.</DT> - <DT>A more structured approach is below.<BR> - <BR> - Since April 2011 a special purpose setup file has been included in the io package (chk_spreadsheet_support.m). Large parts of the approach below (starting at Step 2) have been automated in this script. When running it with the second input argument (debug level) set to 3 a lot of useful diagnostic output will be printed to screen.</DT> - </DL> - <OL> - - <LI>Check if COM / ActiveXworks (only under Windows OS). Do a </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>pkg list </FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>and see</LI> - </FONT></FONT><P>a. <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>If there's a windows package mentioned (then it's installed). If not, install it.</P> - <P>b. If there's an asterisk on the windows package line (then the package is loaded). If not, do a </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>pkg load windows</FONT></FONT> </P> - <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><LI>Check if the ActiveX server works. Do:</LI> - </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2><P>exl = actxserver ('Excel.Application')</FONT></FONT> <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>## Note the period between "Excel" and "Application"</P> - <P>If a COM object is returned, ActiveX / COM / Excel works. Do: </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>exl.Quit(); delete (exl)</FONT></FONT> <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>to shut down the (hidden) Excel invocation.</P> - <P>If you get an error message, your last resort is re-installing the windows package, or trying the Java-based interfaces.</P> - <LI>Check if java works. Do a </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>pkg list </FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>and see</LI></OL> - <DIR> - <DIR> - - </FONT></FONT><P>a. <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>If there's a java package mentioned (then it's installed). If not, install it.</P> - <P>b. If there's an asterisk on the java package line (then the package is loaded). If not, do a </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>pkg rebuild -auto java</P></DIR> - </DIR> - - <OL START=4> - - </FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><LI>Check Java memory settings. Try </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>javamem</LI> - </FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><P>a. If it works, check if it reports sufficiently large max memory (had better be 200 MiB, the bigger the better)</P> - <P>b. If it doesn't work, do:</FONT></FONT> </P> - <FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2><P>rt = java_invoke ('java.lang.Runtime', 'getRuntime')<BR> - rt.gc<BR> - rt.maxMemory ().doubleValue () / 1024 / 1024</P> - </FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><P>The last command will show MaxMemory in MiB.<br></P> - <P>c. In case you have insufficient memory, see in "GOTCHAS", "Java memory pool allocation size", how to increase java's memory pre-reservation.</P> - <LI>Check if all classes (.jarfiles) are in class path. Do a '</FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>javaclasspath</FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>' (under unix/linux, do '</FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>tmp = javaclasspath; strsplit (tmp,":")</FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>' (w/o quotes). See above under "REQUIRED SUPPORT SOFTWARE" what classes should be mentioned.</LI></OL> - <DIR> - <DIR> - - <P>If classes (.jar files) are missing, download and put them somewhere and add them to the javaclass path with their fully qualified pathname (in quotes) using </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>javaaddpath()</FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>.</P></DIR> - </DIR> - - <P>Once all classes are present and in the javaclasspath, the xls interfaces should just work. The only remaining showstoppers are insufficient write privileges for the working directory, a wrecked up octave or some other problem outside octave.</P> - <OL START=6> - - <LI>Try opening an xls file: </LI></OL> - <DIR> - <DIR> - - </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2><P>xls1 = xlsopen ('test.xls', 1, 'poi')</FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>. If this works and xls1 is a struct with various fields containing objects, the Apache POI interface (POI) works. Do an </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>xls1 = xlsclose (xls1)</FONT></FONT> <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>to close the file.</P> - </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2><P>xls2 = xlsopen ('test.xls', 1, 'jxl')</FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>. If this works and xls2 is a struct with various fields containing objects, the JExcelAPI interface (JXL) works as well. Don't forget to do </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>xls2 = xlsclose (xls2)</FONT></FONT> <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>to close the file.</P></DIR> - </DIR> - - </FONT></FONT><B><U><FONT FACE="Arial, sans-serif" SIZE=4><FONT FACE="Arial, sans-serif" SIZE=4><P ALIGN="CENTER">DEVELOPMENT</P> - </U></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DT>xlsopen</B>/<B>xlsclos</B>e and friends have been written so that adding other interfaces (Perl? native octave? ...?) should be very easily accomplished. <B>Xlsopen.m</B> merely needs two stanzas, <B>xlsfinfo.m</B> and <B>getusedrange.m</B> each need an additional elseif stanza, and <B>xlsclose.m</B> needs a small stanza for closing the pointer struct and writing to disk. </DT> - <DT>The real work lies in creating the relevant <B><I>xls2<...>2oct</B></I> & <B><I>oct2<...>2xls</B></I> & <B><I><getusedrange_...></B></I> subfunction scripts in <B>xls2oct.m</B>, <B>oct2xls.m</B> and <B>getusedrange.m</B>, resp., but that shouldn't be really hard, depending on the interface support libraries' quality and documentation. Separating the file access functions and the actual reading/writing from/to the workbook in memory has made developer's life (I mean: my time developing this stuff) much easier.<BR> - <BR> - Some other options for development (who?):</DT> - </DL> - - <UL> - <LI>Speeding up, especially Java worksheet/cell access. For cracks, not me.</LI> - <LI>Automatic conversion of Excel date/time values into octave ones and vice versa (adding or subtracting 636960). But then again Excel's dates are 01-01-1900 based (octave's 0-0-0000) and buggy (Excel thinks 1900 is a leap year), and I sometimes have to use dates from before 1900. Maybe as an option?</LI> - <LI>Creating Excel graphs (a significant enterprise to write from scratch).</LI> - <LI>Support for "passing function handle" in xlsread.</LI></UL> - - <P>Enjoy!</FONT></FONT> </P> - <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DD ALIGN="CENTER">Philip Nienhuis, September 7, 2012</DD> - </DL></FONT></FONT></BODY> - </HTML> - \ No newline at end of file +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252"> +<META NAME="Generator" CONTENT="Microsoft Word 97"> +<META NAME="CREATED" CONTENT="20091211;17230700"> +<META NAME="CHANGEDBY" CONTENT="Philip Nienhuis"> +<META NAME="CHANGED" CONTENT="20120226;18083900"> +</HEAD> +<BODY LINK="#0000ff" VLINK="#800080"> + +<P><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"></P> +<FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><P ALIGN="CENTER">README for Excel spreadsheet file r/w access scripts for octave (> 3.4.0)<BR> +<BR> +Copyright (C) 2009 - 2012 Philip Nienhuis <prnienhuis at users.sf.net><BR> +<BR> +This version September 7, 2012</P> +</FONT></FONT><B><U><FONT FACE="Arial, sans-serif" SIZE=4><FONT FACE="Arial, sans-serif" SIZE=4><P ALIGN="CENTER">EXCEL .XLS SUPPORT FILES</P> +</B></U></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> +<DT><BR> +<B>doc/README-XLS.html</B><BR> +This file.</FONT></FONT> </DT><BR> +<B><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-s... [truncated message content] |