updating to 0.16.6
This commit is contained in:
parent
3e99af3174
commit
994ae22552
|
@ -517,6 +517,17 @@ describe('parse options', function() {
|
|||
assert(found);
|
||||
});
|
||||
});
|
||||
it('should preserve `_xlfn.` only when requested', function() {
|
||||
var wb = { SheetNames: ["Sheet1"], Sheets: { Sheet1: {
|
||||
"!ref": "A1:A1",
|
||||
"A1": { t:"n", v:2, f:"_xlfn.IFS(2>3,1,3>2,2)"}
|
||||
} } };
|
||||
var str = X.write(wb, {bookType: "xlsx", type: "binary"});
|
||||
var wb2 = X.read(str, {type: "binary"});
|
||||
assert.equal(wb2.Sheets.Sheet1["A1"].f, "IFS(2>3,1,3>2,2)");
|
||||
var wb3 = X.read(str, {type: "binary", xlfn: true});
|
||||
assert.equal(wb3.Sheets.Sheet1["A1"].f, "_xlfn.IFS(2>3,1,3>2,2)");
|
||||
});
|
||||
});
|
||||
describe('sheet', function() {
|
||||
it('should not generate sheet stubs by default', function() {
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
17
xlsx.js
17
xlsx.js
|
@ -4,7 +4,7 @@
|
|||
/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false */
|
||||
var XLSX = {};
|
||||
function make_xlsx_lib(XLSX){
|
||||
XLSX.version = '0.16.5';
|
||||
XLSX.version = '0.16.6';
|
||||
var current_codepage = 1200, current_ansi = 1252;
|
||||
/*global cptable:true, window */
|
||||
if(typeof module !== "undefined" && typeof require !== 'undefined') {
|
||||
|
@ -2996,7 +2996,7 @@ function resolve_path(path, base) {
|
|||
}
|
||||
var XML_HEADER = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r\n';
|
||||
var attregexg=/([^"\s?>\/]+)\s*=\s*((?:")([^"]*)(?:")|(?:')([^']*)(?:')|([^'">\s]+))/g;
|
||||
var tagregex=/<[\/\?]?[a-zA-Z0-9:_-]+(?:\s+[^"\s?>\/]+\s*=\s*(?:"[^"]*"|'[^']*'|[^'">\s=]+))*\s?[\/\?]?>/g;
|
||||
var tagregex=/<[\/\?]?[a-zA-Z0-9:_-]+(?:\s+[^"\s?>\/]+\s*=\s*(?:"[^"]*"|'[^']*'|[^'">\s=]+))*\s?[\/\?]?>/mg;
|
||||
|
||||
if(!(XML_HEADER.match(tagregex))) tagregex = /<[^>]*>/g;
|
||||
var nsregex=/<\w*:/, nsregex2 = /<(\/?)\w+:/;
|
||||
|
@ -8343,7 +8343,7 @@ var sirphregex = /<(?:\w+:)?rPh.*?>([\s\S]*?)<\/(?:\w+:)?rPh>/g;
|
|||
function parse_si(x, opts) {
|
||||
var html = opts ? opts.cellHTML : true;
|
||||
var z = {};
|
||||
if(!x) return null;
|
||||
if(!x) return { t: "" };
|
||||
//var y;
|
||||
/* 18.4.12 t ST_Xstring (Plaintext String) */
|
||||
// TODO: is whitespace actually valid here?
|
||||
|
@ -13551,14 +13551,17 @@ return function parse_ws_xml_data(sdata, s, opts, guess, themes, styles) {
|
|||
if(opts.cellFormula) {
|
||||
if((cref=d.match(match_f))!= null && cref[1] !== '') {
|
||||
/* TODO: match against XLSXFutureFunctions */
|
||||
p.f=_xlfn(unescapexml(utf8read(cref[1])));
|
||||
p.f=unescapexml(utf8read(cref[1]));
|
||||
if(!opts.xlfn) p.f = _xlfn(p.f);
|
||||
if(cref[0].indexOf('t="array"') > -1) {
|
||||
p.F = (d.match(refregex)||[])[1];
|
||||
if(p.F.indexOf(":") > -1) arrayf.push([safe_decode_range(p.F), p.F]);
|
||||
} else if(cref[0].indexOf('t="shared"') > -1) {
|
||||
// TODO: parse formula
|
||||
ftag = parsexmltag(cref[0]);
|
||||
sharedf[parseInt(ftag.si, 10)] = [ftag, _xlfn(unescapexml(utf8read(cref[1]))), tag.r];
|
||||
var ___f = unescapexml(utf8read(cref[1]));
|
||||
if(!opts.xlfn) ___f = _xlfn(___f);
|
||||
sharedf[parseInt(ftag.si, 10)] = [ftag, ___f, tag.r];
|
||||
}
|
||||
} else if((cref=d.match(/<f[^>]*\/>/))) {
|
||||
ftag = parsexmltag(cref[0]);
|
||||
|
@ -21462,8 +21465,8 @@ utils.book_new = function() {
|
|||
|
||||
/* add a worksheet to the end of a given workbook */
|
||||
utils.book_append_sheet = function(wb, ws, name) {
|
||||
if(!name) for(var i = 1; i <= 0xFFFF; ++i) if(wb.SheetNames.indexOf(name = "Sheet" + i) == -1) break;
|
||||
if(!name) throw new Error("Too many worksheets");
|
||||
if(!name) for(var i = 1; i <= 0xFFFF; ++i, name = undefined) if(wb.SheetNames.indexOf(name = "Sheet" + i) == -1) break;
|
||||
if(!name || wb.SheetNames.length >= 0xFFFF) throw new Error("Too many worksheets");
|
||||
check_ws_name(name);
|
||||
if(wb.SheetNames.indexOf(name) >= 0) throw new Error("Worksheet with name |" + name + "| already exists!");
|
||||
|
||||
|
|
Loading…
Reference in New Issue