LICENSE clarification; get_formulae function

To avoid future confusion, any code shared between this and the XLS project
relate to concepts discussed in ECMA-376 and hence fall within the purview of
this project's license.  A similar note should appear in the license for the
other projects.
This commit is contained in:
SheetJS 2013-04-13 13:00:01 -04:00
parent 5341a85f55
commit c5c3eebb09
3 changed files with 32 additions and 4 deletions

@ -1,4 +1,4 @@
Copyright (C) 2012 Niggler
Copyright (C) 2012-2013 Niggler
The MIT License (MIT)
@ -11,4 +11,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
Except where noted, this license applies to any and all software programs and associated documentation files created by the Original Author and distributed with the Software:
'jszip.js' is a modified version of JSZip, Copyright (c) Stuart Knightley, David Duponchel, Franz Buchinger, Ant'onio Afonso. JSZip is dual licensed and is used according to the terms of the MIT License.
'jszip.js' is a modified version of JSZip, Copyright (c) Stuart Knightley, David Duponchel, Franz Buchinger, Ant'onio Afonso. JSZip is dual licensed and is used according to the terms of the MIT License.
Any code shared between this project and the Apache-licensed XLS parser by the same author (all of which draws from the ECMA-376 specification) falls under this license.

@ -50,7 +50,7 @@ function sheet_to_row_object_array(sheet){
emptyRow = false;
}
break;
case 'e': break; /* thorw */
case 'e': break; /* throw */
default: throw 'unrecognized type ' + val.t;
}
}
@ -87,6 +87,18 @@ function sheet_to_csv(sheet) {
return out;
}
function get_formulae(ws) {
var cmds = [];
for(y in ws) if(y[0] !=='!' && ws.hasOwnProperty(y)) (function(y,x) {
var val = "";
if(x.f) val = x.f;
else if(typeof x.v === 'number') val = x.v;
else val = x.v;
cmds.push(y + "=" + val);
})(y,ws[y]);
return cmds;
}
var utils = {
encode_col: encode_col,
encode_row: encode_row,
@ -98,5 +110,6 @@ var utils = {
decode_cell: decode_cell,
decode_range: decode_range,
sheet_to_csv: sheet_to_csv,
get_formulae: get_formulae,
sheet_to_row_object_array: sheet_to_row_object_array
};

15
xlsx.js

@ -877,7 +877,7 @@ function sheet_to_row_object_array(sheet){
emptyRow = false;
}
break;
case 'e': break; /* thorw */
case 'e': break; /* throw */
default: throw 'unrecognized type ' + val.t;
}
}
@ -914,6 +914,18 @@ function sheet_to_csv(sheet) {
return out;
}
function get_formulae(ws) {
var cmds = [];
for(y in ws) if(y[0] !=='!' && ws.hasOwnProperty(y)) (function(y,x) {
var val = "";
if(x.f) val = x.f;
else if(typeof x.v === 'number') val = x.v;
else val = x.v;
cmds.push(y + "=" + val);
})(y,ws[y]);
return cmds;
}
var utils = {
encode_col: encode_col,
encode_row: encode_row,
@ -925,6 +937,7 @@ var utils = {
decode_cell: decode_cell,
decode_range: decode_range,
sheet_to_csv: sheet_to_csv,
get_formulae: get_formulae,
sheet_to_row_object_array: sheet_to_row_object_array
};