version bump 0.7.1: test now ignores missing files
apparently openpyxl removed a few test files from their suite :/
This commit is contained in:
parent
d15b81e0e9
commit
a1990758a0
|
@ -159,7 +159,7 @@ The exported `write` and `writeFile` functions accept an options argument:
|
|||
|
||||
- `bookSST` is slower and more memory intensive, but has better compatibility
|
||||
with iOS Numbers
|
||||
- `bookType = 'xlsb'` is stubbed and far from complete
|
||||
- `bookType = 'xlsb'` is stubbed and far from complete
|
||||
- The raw data is the only thing guaranteed to be saved. Formulae, formatting,
|
||||
and other niceties are not serialized (pending CSF standardization)
|
||||
|
||||
|
|
|
@ -95,11 +95,12 @@ try {
|
|||
process.exit(4);
|
||||
}
|
||||
|
||||
if(!program.quiet) console.error(target_sheet);
|
||||
var oo = "";
|
||||
if(!program.quiet) console.error(target_sheet);
|
||||
if(program.formulae) oo = X.utils.get_formulae(ws).join("\n");
|
||||
else if(program.json) oo = JSON.stringify(X.utils.sheet_to_row_object_array(ws));
|
||||
else if(program.rawJs) oo = JSON.stringify(X.utils.sheet_to_row_object_array(ws,{raw:true}));
|
||||
else oo = X.utils.make_csv(ws, {FS:program.fieldSep, RS:program.rowSep});
|
||||
|
||||
if(program.output) fs.writeFileSync(program.output, oo);
|
||||
else console.log(oo);
|
||||
|
|
|
@ -1 +1 @@
|
|||
XLSX.version = '0.7.0';
|
||||
XLSX.version = '0.7.1';
|
||||
|
|
|
@ -223,7 +223,7 @@ function write_ct(ct, opts) {
|
|||
v = ct[w][0];
|
||||
o.push(writextag('Override', null, {
|
||||
'PartName': (v[0] == '/' ? "":"/") + v,
|
||||
'ContentType': CT_LIST[w][opts.bookType || 'xlsx']
|
||||
'ContentType': CT_LIST[w][opts.bookType || 'xlsx']
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
@ -231,7 +231,7 @@ function write_ct(ct, opts) {
|
|||
ct[w].forEach(function(v) {
|
||||
o.push(writextag('Override', null, {
|
||||
'PartName': (v[0] == '/' ? "":"/") + v,
|
||||
'ContentType': CT_LIST[w][opts.bookType || 'xlsx']
|
||||
'ContentType': CT_LIST[w][opts.bookType || 'xlsx']
|
||||
}));
|
||||
});
|
||||
};
|
||||
|
@ -245,7 +245,7 @@ function write_ct(ct, opts) {
|
|||
};
|
||||
f1('workbooks');
|
||||
f2('sheets');
|
||||
f3('themes');
|
||||
f3('themes');
|
||||
['strs', 'styles'].forEach(f1);
|
||||
['coreprops', 'extprops', 'custprops'].forEach(f3);
|
||||
if(o.length>2){ o.push('</Types>'); o[1]=o[1].replace("/>",">"); }
|
||||
|
|
|
@ -58,7 +58,7 @@ function write_cust_props(cp, opts) {
|
|||
o.push(CUST_PROPS_XML_ROOT);
|
||||
if(!cp) return o.join("");
|
||||
var pid = 1;
|
||||
keys(cp).forEach(function(k) { ++pid;
|
||||
keys(cp).forEach(function(k) { ++pid;
|
||||
o.push(writextag('property', write_vt(cp[k]), {
|
||||
'fmtid': '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}',
|
||||
'pid': pid,
|
||||
|
|
|
@ -180,7 +180,7 @@ var write_sst_xml = function(sst, opts) {
|
|||
count: sst.Count,
|
||||
uniqueCount: sst.Unique
|
||||
}));
|
||||
sst.forEach(function(s) { o.push("<si>" + (s.r ? s.r : "<t>" + escapexml(s.t) + "</t>") + "</si>"); });
|
||||
sst.forEach(function(s) { o.push("<si>" + (s.r ? s.r : "<t>" + escapexml(s.t) + "</t>") + "</si>"); });
|
||||
if(o.length>2){ o.push('</sst>'); o[1]=o[1].replace("/>",">"); }
|
||||
return o.join("");
|
||||
};
|
||||
|
|
|
@ -19,8 +19,7 @@ function write_numFmts(NF, opts) {
|
|||
var o = [];
|
||||
o.push("<numFmts>");
|
||||
[[5,8],[23,26],[41,44],[63,66],[164,392]].forEach(function(r) {
|
||||
for(var i = r[0]; i <= r[1]; ++i) if(NF[i])
|
||||
o.push(writextag('numFmt',null,{numFmtId:i,formatCode:escapexml(NF[i])}));
|
||||
for(var i = r[0]; i <= r[1]; ++i) if(NF[i]) o.push(writextag('numFmt',null,{numFmtId:i,formatCode:escapexml(NF[i])}));
|
||||
});
|
||||
o.push("</numFmts>");
|
||||
if(o.length === 2) return "";
|
||||
|
|
|
@ -130,7 +130,7 @@ var WS_XML_ROOT = writextag('worksheet', null, {
|
|||
|
||||
var write_ws_xml_cell = function(cell, ref, ws, opts, idx, wb) {
|
||||
var v = writextag('v', escapexml(String(cell.v))), o = {r:ref};
|
||||
if(cell.z) o.s = get_cell_style(opts.cellXfs, cell, opts);
|
||||
if(cell.z) o.s = get_cell_style(opts.cellXfs, cell, opts);
|
||||
/* TODO: cell style */
|
||||
if(typeof cell.v === 'undefined') return "";
|
||||
switch(cell.t) {
|
||||
|
@ -142,7 +142,7 @@ var write_ws_xml_cell = function(cell, ref, ws, opts, idx, wb) {
|
|||
} break;
|
||||
case 'n': o.t = "n"; return writextag('c', v, o);
|
||||
case 'b': o.t = "b"; return writextag('c', v, o);
|
||||
case 'e': o.t = "e"; return writextag('c', v, o);
|
||||
case 'e': o.t = "e"; return writextag('c', v, o);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ function add_rels(rels, rId, f, type, relobj) {
|
|||
if(!relobj) relobj = {};
|
||||
if(!rels['!id']) rels['!id'] = {};
|
||||
relobj.Id = 'rId' + rId;
|
||||
relobj.Type = type;
|
||||
relobj.Type = type;
|
||||
relobj.Target = f;
|
||||
if(rels['!id'][relobj.Id]) throw new Error("Cannot rewrite rId " + rId);
|
||||
rels['!id'][relobj.Id] = relobj;
|
||||
|
@ -65,7 +65,7 @@ function write_zip(wb, opts) {
|
|||
}
|
||||
|
||||
/* TODO: something more intelligent with themes */
|
||||
|
||||
|
||||
/* f = "xl/theme/theme1.xml"
|
||||
zip.file(f, write_theme());
|
||||
ct.themes.push(f);
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -2,7 +2,7 @@
|
|||
/* vim: set ts=2: */
|
||||
var XLSX = {};
|
||||
(function(XLSX){
|
||||
XLSX.version = '0.7.0';
|
||||
XLSX.version = '0.7.1';
|
||||
var current_codepage = 1252, current_cptable;
|
||||
if(typeof module !== "undefined" && typeof require !== 'undefined') {
|
||||
if(typeof cptable === 'undefined') cptable = require('codepage');
|
||||
|
@ -1115,7 +1115,7 @@ function write_ct(ct, opts) {
|
|||
v = ct[w][0];
|
||||
o.push(writextag('Override', null, {
|
||||
'PartName': (v[0] == '/' ? "":"/") + v,
|
||||
'ContentType': CT_LIST[w][opts.bookType || 'xlsx']
|
||||
'ContentType': CT_LIST[w][opts.bookType || 'xlsx']
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
@ -1123,7 +1123,7 @@ function write_ct(ct, opts) {
|
|||
ct[w].forEach(function(v) {
|
||||
o.push(writextag('Override', null, {
|
||||
'PartName': (v[0] == '/' ? "":"/") + v,
|
||||
'ContentType': CT_LIST[w][opts.bookType || 'xlsx']
|
||||
'ContentType': CT_LIST[w][opts.bookType || 'xlsx']
|
||||
}));
|
||||
});
|
||||
};
|
||||
|
@ -1137,7 +1137,7 @@ function write_ct(ct, opts) {
|
|||
};
|
||||
f1('workbooks');
|
||||
f2('sheets');
|
||||
f3('themes');
|
||||
f3('themes');
|
||||
['strs', 'styles'].forEach(f1);
|
||||
['coreprops', 'extprops', 'custprops'].forEach(f3);
|
||||
if(o.length>2){ o.push('</Types>'); o[1]=o[1].replace("/>",">"); }
|
||||
|
@ -1405,7 +1405,7 @@ function write_cust_props(cp, opts) {
|
|||
o.push(CUST_PROPS_XML_ROOT);
|
||||
if(!cp) return o.join("");
|
||||
var pid = 1;
|
||||
keys(cp).forEach(function(k) { ++pid;
|
||||
keys(cp).forEach(function(k) { ++pid;
|
||||
o.push(writextag('property', write_vt(cp[k]), {
|
||||
'fmtid': '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}',
|
||||
'pid': pid,
|
||||
|
@ -1597,7 +1597,7 @@ var write_sst_xml = function(sst, opts) {
|
|||
count: sst.Count,
|
||||
uniqueCount: sst.Unique
|
||||
}));
|
||||
sst.forEach(function(s) { o.push("<si>" + (s.r ? s.r : "<t>" + escapexml(s.t) + "</t>") + "</si>"); });
|
||||
sst.forEach(function(s) { o.push("<si>" + (s.r ? s.r : "<t>" + escapexml(s.t) + "</t>") + "</si>"); });
|
||||
if(o.length>2){ o.push('</sst>'); o[1]=o[1].replace("/>",">"); }
|
||||
return o.join("");
|
||||
};
|
||||
|
@ -1648,8 +1648,7 @@ function write_numFmts(NF, opts) {
|
|||
var o = [];
|
||||
o.push("<numFmts>");
|
||||
[[5,8],[23,26],[41,44],[63,66],[164,392]].forEach(function(r) {
|
||||
for(var i = r[0]; i <= r[1]; ++i) if(NF[i])
|
||||
o.push(writextag('numFmt',null,{numFmtId:i,formatCode:escapexml(NF[i])}));
|
||||
for(var i = r[0]; i <= r[1]; ++i) if(NF[i]) o.push(writextag('numFmt',null,{numFmtId:i,formatCode:escapexml(NF[i])}));
|
||||
});
|
||||
o.push("</numFmts>");
|
||||
if(o.length === 2) return "";
|
||||
|
@ -2178,7 +2177,7 @@ var WS_XML_ROOT = writextag('worksheet', null, {
|
|||
|
||||
var write_ws_xml_cell = function(cell, ref, ws, opts, idx, wb) {
|
||||
var v = writextag('v', escapexml(String(cell.v))), o = {r:ref};
|
||||
if(cell.z) o.s = get_cell_style(opts.cellXfs, cell, opts);
|
||||
if(cell.z) o.s = get_cell_style(opts.cellXfs, cell, opts);
|
||||
/* TODO: cell style */
|
||||
if(typeof cell.v === 'undefined') return "";
|
||||
switch(cell.t) {
|
||||
|
@ -2190,7 +2189,7 @@ var write_ws_xml_cell = function(cell, ref, ws, opts, idx, wb) {
|
|||
} break;
|
||||
case 'n': o.t = "n"; return writextag('c', v, o);
|
||||
case 'b': o.t = "b"; return writextag('c', v, o);
|
||||
case 'e': o.t = "e"; return writextag('c', v, o);
|
||||
case 'e': o.t = "e"; return writextag('c', v, o);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -3876,7 +3875,7 @@ function add_rels(rels, rId, f, type, relobj) {
|
|||
if(!relobj) relobj = {};
|
||||
if(!rels['!id']) rels['!id'] = {};
|
||||
relobj.Id = 'rId' + rId;
|
||||
relobj.Type = type;
|
||||
relobj.Type = type;
|
||||
relobj.Target = f;
|
||||
if(rels['!id'][relobj.Id]) throw new Error("Cannot rewrite rId " + rId);
|
||||
rels['!id'][relobj.Id] = relobj;
|
||||
|
@ -3939,7 +3938,7 @@ function write_zip(wb, opts) {
|
|||
}
|
||||
|
||||
/* TODO: something more intelligent with themes */
|
||||
|
||||
|
||||
/* f = "xl/theme/theme1.xml"
|
||||
zip.file(f, write_theme());
|
||||
ct.themes.push(f);
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,15 +1,15 @@
|
|||
{
|
||||
"name": "xlsx",
|
||||
"version": "0.7.0",
|
||||
"version": "0.7.1",
|
||||
"author": "sheetjs",
|
||||
"description": "XLSB / XLSX / XLSM (Excel 2007+ Spreadsheet) parser",
|
||||
"description": "XLSB/XLSX/XLSM (Excel 2007+ Spreadsheet) parser and writer",
|
||||
"keywords": [ "xlsx", "xlsb", "xlsm", "office", "excel", "spreadsheet" ],
|
||||
"bin": {
|
||||
"xlsx": "./bin/xlsx.njs"
|
||||
},
|
||||
"main": "./xlsx",
|
||||
"dependencies": {
|
||||
"ssf":"~0.6.4",
|
||||
"ssf":"~0.6.5",
|
||||
"codepage":"1.x",
|
||||
"cfb":"",
|
||||
"jszip":"2.2.0",
|
||||
|
@ -17,6 +17,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"mocha":"",
|
||||
"xlsjs":"",
|
||||
"uglify-js":"",
|
||||
"jasmine-node": "x"
|
||||
},
|
||||
|
|
2
test.js
2
test.js
|
@ -127,6 +127,7 @@ function parsetest(x, wb, full, ext) {
|
|||
|
||||
describe('should parse test files', function() {
|
||||
files.forEach(function(x) {
|
||||
if(!fs.existsSync(dir + x)) return;
|
||||
it(x, x.substr(-8) == ".pending" ? null : function() {
|
||||
var wb = X.readFile(dir + x, opts);
|
||||
parsetest(x, wb, true);
|
||||
|
@ -136,6 +137,7 @@ describe('should parse test files', function() {
|
|||
});
|
||||
});
|
||||
fileA.forEach(function(x) {
|
||||
if(!fs.existsSync(dir + x)) return;
|
||||
it(x, x.substr(-8) == ".pending" ? null : function() {
|
||||
var wb = X.readFile(dir + x, {WTF:opts.wtf, sheetRows:10});
|
||||
parsetest(x, wb, false);
|
||||
|
|
23
xlsx.js
23
xlsx.js
|
@ -2,7 +2,7 @@
|
|||
/* vim: set ts=2: */
|
||||
var XLSX = {};
|
||||
(function(XLSX){
|
||||
XLSX.version = '0.7.0';
|
||||
XLSX.version = '0.7.1';
|
||||
var current_codepage = 1252, current_cptable;
|
||||
if(typeof module !== "undefined" && typeof require !== 'undefined') {
|
||||
if(typeof cptable === 'undefined') cptable = require('codepage');
|
||||
|
@ -1115,7 +1115,7 @@ function write_ct(ct, opts) {
|
|||
v = ct[w][0];
|
||||
o.push(writextag('Override', null, {
|
||||
'PartName': (v[0] == '/' ? "":"/") + v,
|
||||
'ContentType': CT_LIST[w][opts.bookType || 'xlsx']
|
||||
'ContentType': CT_LIST[w][opts.bookType || 'xlsx']
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
@ -1123,7 +1123,7 @@ function write_ct(ct, opts) {
|
|||
ct[w].forEach(function(v) {
|
||||
o.push(writextag('Override', null, {
|
||||
'PartName': (v[0] == '/' ? "":"/") + v,
|
||||
'ContentType': CT_LIST[w][opts.bookType || 'xlsx']
|
||||
'ContentType': CT_LIST[w][opts.bookType || 'xlsx']
|
||||
}));
|
||||
});
|
||||
};
|
||||
|
@ -1137,7 +1137,7 @@ function write_ct(ct, opts) {
|
|||
};
|
||||
f1('workbooks');
|
||||
f2('sheets');
|
||||
f3('themes');
|
||||
f3('themes');
|
||||
['strs', 'styles'].forEach(f1);
|
||||
['coreprops', 'extprops', 'custprops'].forEach(f3);
|
||||
if(o.length>2){ o.push('</Types>'); o[1]=o[1].replace("/>",">"); }
|
||||
|
@ -1405,7 +1405,7 @@ function write_cust_props(cp, opts) {
|
|||
o.push(CUST_PROPS_XML_ROOT);
|
||||
if(!cp) return o.join("");
|
||||
var pid = 1;
|
||||
keys(cp).forEach(function(k) { ++pid;
|
||||
keys(cp).forEach(function(k) { ++pid;
|
||||
o.push(writextag('property', write_vt(cp[k]), {
|
||||
'fmtid': '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}',
|
||||
'pid': pid,
|
||||
|
@ -1597,7 +1597,7 @@ var write_sst_xml = function(sst, opts) {
|
|||
count: sst.Count,
|
||||
uniqueCount: sst.Unique
|
||||
}));
|
||||
sst.forEach(function(s) { o.push("<si>" + (s.r ? s.r : "<t>" + escapexml(s.t) + "</t>") + "</si>"); });
|
||||
sst.forEach(function(s) { o.push("<si>" + (s.r ? s.r : "<t>" + escapexml(s.t) + "</t>") + "</si>"); });
|
||||
if(o.length>2){ o.push('</sst>'); o[1]=o[1].replace("/>",">"); }
|
||||
return o.join("");
|
||||
};
|
||||
|
@ -1648,8 +1648,7 @@ function write_numFmts(NF, opts) {
|
|||
var o = [];
|
||||
o.push("<numFmts>");
|
||||
[[5,8],[23,26],[41,44],[63,66],[164,392]].forEach(function(r) {
|
||||
for(var i = r[0]; i <= r[1]; ++i) if(NF[i])
|
||||
o.push(writextag('numFmt',null,{numFmtId:i,formatCode:escapexml(NF[i])}));
|
||||
for(var i = r[0]; i <= r[1]; ++i) if(NF[i]) o.push(writextag('numFmt',null,{numFmtId:i,formatCode:escapexml(NF[i])}));
|
||||
});
|
||||
o.push("</numFmts>");
|
||||
if(o.length === 2) return "";
|
||||
|
@ -2178,7 +2177,7 @@ var WS_XML_ROOT = writextag('worksheet', null, {
|
|||
|
||||
var write_ws_xml_cell = function(cell, ref, ws, opts, idx, wb) {
|
||||
var v = writextag('v', escapexml(String(cell.v))), o = {r:ref};
|
||||
if(cell.z) o.s = get_cell_style(opts.cellXfs, cell, opts);
|
||||
if(cell.z) o.s = get_cell_style(opts.cellXfs, cell, opts);
|
||||
/* TODO: cell style */
|
||||
if(typeof cell.v === 'undefined') return "";
|
||||
switch(cell.t) {
|
||||
|
@ -2190,7 +2189,7 @@ var write_ws_xml_cell = function(cell, ref, ws, opts, idx, wb) {
|
|||
} break;
|
||||
case 'n': o.t = "n"; return writextag('c', v, o);
|
||||
case 'b': o.t = "b"; return writextag('c', v, o);
|
||||
case 'e': o.t = "e"; return writextag('c', v, o);
|
||||
case 'e': o.t = "e"; return writextag('c', v, o);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -3876,7 +3875,7 @@ function add_rels(rels, rId, f, type, relobj) {
|
|||
if(!relobj) relobj = {};
|
||||
if(!rels['!id']) rels['!id'] = {};
|
||||
relobj.Id = 'rId' + rId;
|
||||
relobj.Type = type;
|
||||
relobj.Type = type;
|
||||
relobj.Target = f;
|
||||
if(rels['!id'][relobj.Id]) throw new Error("Cannot rewrite rId " + rId);
|
||||
rels['!id'][relobj.Id] = relobj;
|
||||
|
@ -3939,7 +3938,7 @@ function write_zip(wb, opts) {
|
|||
}
|
||||
|
||||
/* TODO: something more intelligent with themes */
|
||||
|
||||
|
||||
/* f = "xl/theme/theme1.xml"
|
||||
zip.file(f, write_theme());
|
||||
ct.themes.push(f);
|
||||
|
|
Loading…
Reference in New Issue