IO package: Difference between revisions

Jump to navigation Jump to search
318 bytes added ,  31 January 2020
(2 intermediate revisions by the same user not shown)
Line 490: Line 490:


==== Spreadsheet formula support ====
==== Spreadsheet formula support ====
When using the COM, POI, JXL, and UNO interfaces you can:
When using the OCT, COM, POI, JXL, and UNO interfaces you can:
* (When reading, xls2oct) either read spreadsheet formula results, or the literal formula text strings (also works with OCT interface);
* (When reading, xls2oct) either read spreadsheet formula results, or the literal formula text strings (also works with OCT interface);
* (When writing, oct2xls) either enter formulas in the worksheet as formulas, or enter them as literal text strings.
* (When writing, oct2xls) either enter formulas in the worksheet as formulas, or enter them as literal text strings.
Line 502: Line 502:
Be aware that there's no formula evaluator in JExcelAPI (JXL) nor OpenXLS (OXS). So if you create formulas in your spreadsheet using oct2xls or xlswrite with 'JXL' or 'OXS', do not expect meaningful results when reading those files later on ,unless you open them in Excel and write them back to disk.
Be aware that there's no formula evaluator in JExcelAPI (JXL) nor OpenXLS (OXS). So if you create formulas in your spreadsheet using oct2xls or xlswrite with 'JXL' or 'OXS', do not expect meaningful results when reading those files later on ,unless you open them in Excel and write them back to disk.


While both Apache POI and JExcelAPI feature a formula validator, not all spreadsheet functions present in Excel have been implemented (yet).
While both Apache POI and JExcelAPI feature a formula validator, not all spreadsheet functions present in Excel have been implemented (yet). <br />
Worse, older Excel versions feature less functions than newer versions. So be wary as this may make for interesting confusion.
Worse, older Excel versions feature less functions than newer versions. So be wary as this may make for interesting confusion. <br />
Reading and writing "shared formulas" with the OCT interface isn't (yet) supported; see bug
[https://savannah.gnu.org/bugs/?52875 bug #52875].


==== Matlab compatibility ====
==== Matlab compatibility ====
Line 595: Line 597:
=== OCT interface ===
=== OCT interface ===


Since io package version 1.2.4, an interface called "OCT" was added. Except for unzip, it has no dependencies. It's still experimental but fast! Feel free to test it and give us a feedback.
Since io package version 1.2.4, an interface called "OCT" was added. Except for unzip, it has no dependencies and it is faster than the Java-based interfaces.
Currently it supports reading and writing .xlsx, .ods and .gnumeric files (the latter in yet-to-be-released io-2.2.2).
If  
If  
<pre>chk_spreadsheet_support == 0</pre>
<pre>chk_spreadsheet_support == 0</pre>
Line 604: Line 605:
<pre>m = xlsread ('file.xlsx', 1, [], 'OCT');</pre>
<pre>m = xlsread ('file.xlsx', 1, [], 'OCT');</pre>


Since io package version 2.2.0, the "OCT" interface has experimental write support for .xlsx and .ods formats, since io-2.2.2 (expected mid-May 2014) also for gnumeric. If you can't wait for gnumeric I/O you can checkout a snapshot from svn (see octave.sf.net, http://sourceforge.net/p/octave/code/HEAD/tree/trunk/octave-forge/main/io/)
About development: <br />
The OCT interface makes use of regular expressions for parsing the XML contents of OOXML, ODS and gnumeric formats. While frowned upon by XML gurus (see for example [https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 here] for some amusing postings), using regexps is much faster than any current XML parser. But the trade-off is that regexps are fragile, esp. withregard to the order in which XML tags appear in XML nodes. <br />
Just for reassurance: to date we haven't seen any problems with the OCT interface for reading and writing regular data.
 


[[Category:Octave Forge]]
[[Category:Octave Forge]]
99

edits

Navigation menu