version bump 0.13.4: more corner cases
- explicitly throw when expected AOA isn't (fixes #1214 h/t @mnori) - `ignoreEC` option to suppress IGNOREEC records on write - workaround for BIFF2 BOF mismatch (fixes #1220 h/t @AhmadZuhdi)
This commit is contained in:
parent
01de12d24f
commit
d3d5bfc988
@ -1806,6 +1806,7 @@ The exported `write` and `writeFile` functions accept an options argument:
|
||||
|`compression`| `false` | Use ZIP compression for ZIP-based formats ** |
|
||||
|`Props` | | Override workbook properties when writing ** |
|
||||
|`themeXLSX` | | Override theme XML when writing XLSX/XLSB/XLSM ** |
|
||||
|`ignoreEC` | `true` | Suppress "number as text" errors ** |
|
||||
|
||||
- `bookSST` is slower and more memory intensive, but has better compatibility
|
||||
with older versions of iOS Numbers
|
||||
@ -1818,6 +1819,9 @@ The exported `write` and `writeFile` functions accept an options argument:
|
||||
the [Workbook File Properties](#workbook-file-properties) section.
|
||||
- if specified, the string from `themeXLSX` will be saved as the primary theme
|
||||
for XLSX/XLSB/XLSM files (to `xl/theme/theme1.xml` in the ZIP)
|
||||
- Due to a bug in the program, some features like "Text to Columns" will crash
|
||||
Excel on worksheets where error conditions are ignored. The writer will mark
|
||||
files to ignore the error by default. Set `ignoreEC` to `false` to suppress.
|
||||
|
||||
### Supported Output Formats
|
||||
|
||||
|
@ -1 +1 @@
|
||||
XLSX.version = '0.13.3';
|
||||
XLSX.version = '0.13.4';
|
||||
|
@ -101,6 +101,8 @@ function sheet_add_aoa(_ws/*:?Worksheet*/, data/*:AOA*/, opts/*:?any*/)/*:Worksh
|
||||
if(_R == -1) range.e.r = _R = _range.e.r + 1;
|
||||
}
|
||||
for(var R = 0; R != data.length; ++R) {
|
||||
if(!data[R]) continue;
|
||||
if(!Array.isArray(data[R])) throw new Error("aoa_to_sheet expects an array of arrays");
|
||||
for(var C = 0; C != data[R].length; ++C) {
|
||||
if(typeof data[R][C] === 'undefined') continue;
|
||||
var cell/*:Cell*/ = ({v: data[R][C] }/*:any*/);
|
||||
|
@ -833,17 +833,17 @@ var PRN = (function() {
|
||||
switch(opts.type) {
|
||||
case 'base64': str = Base64.decode(d); break;
|
||||
case 'binary': str = d; break;
|
||||
case 'buffer':
|
||||
if(opts.codepage == 65001) str = d.toString('utf8');
|
||||
else if(opts.codepage && typeof cptable !== 'undefined') str = cptable.utils.decode(opts.codepage, d);
|
||||
else str = d.toString('binary');
|
||||
break;
|
||||
case 'array': str = cc2str(d); break;
|
||||
case 'buffer':
|
||||
if(opts.codepage == 65001) str = d.toString('utf8');
|
||||
else if(opts.codepage && typeof cptable !== 'undefined') str = cptable.utils.decode(opts.codepage, d);
|
||||
else str = d.toString('binary');
|
||||
break;
|
||||
case 'array': str = cc2str(d); break;
|
||||
case 'string': str = d; break;
|
||||
default: throw new Error("Unrecognized type " + opts.type);
|
||||
}
|
||||
if(bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) str = utf8read(str.slice(3));
|
||||
else if((opts.type == 'binary') && typeof cptable !== 'undefined' && opts.codepage) str = cptable.utils.decode(opts.codepage, cptable.utils.encode(1252,str));
|
||||
else if((opts.type == 'binary') && typeof cptable !== 'undefined' && opts.codepage) str = cptable.utils.decode(opts.codepage, cptable.utils.encode(1252,str));
|
||||
if(str.slice(0,19) == "socialcalc:version:") return ETH.to_sheet(opts.type == 'string' ? str : utf8read(str), opts);
|
||||
return prn_to_sheet_str(str, opts);
|
||||
}
|
||||
|
@ -557,7 +557,7 @@ function write_ws_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ {
|
||||
/* customProperties */
|
||||
/* cellWatches */
|
||||
|
||||
o[o.length] = writetag("ignoredErrors", writextag("ignoredError", null, {numberStoredAsText:1, sqref:ref}));
|
||||
if(!opts || opts.ignoreEC || (opts.ignoreEC == (void 0))) o[o.length] = writetag("ignoredErrors", writextag("ignoredError", null, {numberStoredAsText:1, sqref:ref}));
|
||||
|
||||
/* smartTags */
|
||||
|
||||
|
@ -845,7 +845,7 @@ function write_ws_bin(idx/*:number*/, opts, wb/*:Workbook*/, rels) {
|
||||
/* [COLBRK] */
|
||||
/* *BrtBigName */
|
||||
/* [CELLWATCHES] */
|
||||
write_IGNOREECS(ba, ws);
|
||||
if(!opts || opts.ignoreEC || (opts.ignoreEC == (void 0))) write_IGNOREECS(ba, ws);
|
||||
/* [SMARTTAGS] */
|
||||
/* [BrtDrawing] */
|
||||
write_LEGACYDRAWING(ba, ws, idx, rels);
|
||||
|
@ -351,6 +351,7 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
/*::[*/0x0002/*::]*/:2,
|
||||
/*::[*/0x0007/*::]*/:2
|
||||
}[val.BIFFVer] || 8;
|
||||
if(opts.biff == 8 && val.BIFFVer == 0 && val.dt == 16) opts.biff = 2;
|
||||
if(file_depth++) break;
|
||||
cell_valid = true;
|
||||
out = ((options.dense ? [] : {})/*:any*/);
|
||||
|
24
dist/xlsx.core.min.js
generated
vendored
24
dist/xlsx.core.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/xlsx.core.min.map
generated
vendored
2
dist/xlsx.core.min.map
generated
vendored
File diff suppressed because one or more lines are too long
20
dist/xlsx.extendscript.js
generated
vendored
20
dist/xlsx.extendscript.js
generated
vendored
@ -9160,7 +9160,7 @@ module.exports = ZStream;
|
||||
/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false */
|
||||
var XLSX = {};
|
||||
function make_xlsx_lib(XLSX){
|
||||
XLSX.version = '0.13.3';
|
||||
XLSX.version = '0.13.4';
|
||||
var current_codepage = 1200, current_ansi = 1252;
|
||||
/*global cptable:true, window */
|
||||
if(typeof module !== "undefined" && typeof require !== 'undefined') {
|
||||
@ -11302,11 +11302,13 @@ function parsexmltag(tag, skip_root) {
|
||||
if(j===q.length) {
|
||||
if(q.indexOf("_") > 0) q = q.slice(0, q.indexOf("_")); // from ods
|
||||
z[q] = v;
|
||||
z[q.toLowerCase()] = v;
|
||||
}
|
||||
else {
|
||||
var k = (j===5 && q.slice(0,5)==="xmlns"?"xmlns":"")+q.slice(j+1);
|
||||
if(z[k] && q.slice(j-3,j) == "ext") continue; // from ods
|
||||
z[k] = v;
|
||||
z[k.toLowerCase()] = v;
|
||||
}
|
||||
}
|
||||
return z;
|
||||
@ -12012,6 +12014,8 @@ function sheet_add_aoa(_ws, data, opts) {
|
||||
if(_R == -1) range.e.r = _R = _range.e.r + 1;
|
||||
}
|
||||
for(var R = 0; R != data.length; ++R) {
|
||||
if(!data[R]) continue;
|
||||
if(!Array.isArray(data[R])) throw new Error("aoa_to_sheet expects an array of arrays");
|
||||
for(var C = 0; C != data[R].length; ++C) {
|
||||
if(typeof data[R][C] === 'undefined') continue;
|
||||
var cell = ({v: data[R][C] });
|
||||
@ -15878,13 +15882,17 @@ var PRN = (function() {
|
||||
switch(opts.type) {
|
||||
case 'base64': str = Base64.decode(d); break;
|
||||
case 'binary': str = d; break;
|
||||
case 'buffer': str = d.toString('binary'); break;
|
||||
case 'buffer':
|
||||
if(opts.codepage == 65001) str = d.toString('utf8');
|
||||
else if(opts.codepage && typeof cptable !== 'undefined') str = cptable.utils.decode(opts.codepage, d);
|
||||
else str = d.toString('binary');
|
||||
break;
|
||||
case 'array': str = cc2str(d); break;
|
||||
case 'string': str = d; break;
|
||||
default: throw new Error("Unrecognized type " + opts.type);
|
||||
}
|
||||
if(bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) str = utf8read(str.slice(3));
|
||||
else if((opts.type == 'binary' || opts.type == 'buffer') && typeof cptable !== 'undefined' && opts.codepage) str = cptable.utils.decode(opts.codepage, cptable.utils.encode(1252,str));
|
||||
else if((opts.type == 'binary') && typeof cptable !== 'undefined' && opts.codepage) str = cptable.utils.decode(opts.codepage, cptable.utils.encode(1252,str));
|
||||
if(str.slice(0,19) == "socialcalc:version:") return ETH.to_sheet(opts.type == 'string' ? str : utf8read(str), opts);
|
||||
return prn_to_sheet_str(str, opts);
|
||||
}
|
||||
@ -15930,7 +15938,6 @@ function read_wb_ID(d, opts) {
|
||||
return PRN.to_workbook(d, opts);
|
||||
}
|
||||
}
|
||||
|
||||
var WK_ = (function() {
|
||||
function lotushopper(data, cb, opts) {
|
||||
if(!data) return;
|
||||
@ -21758,7 +21765,7 @@ function write_ws_xml(idx, opts, wb, rels) {
|
||||
/* customProperties */
|
||||
/* cellWatches */
|
||||
|
||||
o[o.length] = writetag("ignoredErrors", writextag("ignoredError", null, {numberStoredAsText:1, sqref:ref}));
|
||||
if(!opts || opts.ignoreEC || (opts.ignoreEC == (void 0))) o[o.length] = writetag("ignoredErrors", writextag("ignoredError", null, {numberStoredAsText:1, sqref:ref}));
|
||||
|
||||
/* smartTags */
|
||||
|
||||
@ -22631,7 +22638,7 @@ function write_ws_bin(idx, opts, wb, rels) {
|
||||
/* [COLBRK] */
|
||||
/* *BrtBigName */
|
||||
/* [CELLWATCHES] */
|
||||
write_IGNOREECS(ba, ws);
|
||||
if(!opts || opts.ignoreEC || (opts.ignoreEC == (void 0))) write_IGNOREECS(ba, ws);
|
||||
/* [SMARTTAGS] */
|
||||
/* [BrtDrawing] */
|
||||
write_LEGACYDRAWING(ba, ws, idx, rels);
|
||||
@ -25039,6 +25046,7 @@ wb.opts.Date1904 = Workbook.WBProps.date1904 = val; break;
|
||||
0x0002:2,
|
||||
0x0007:2
|
||||
}[val.BIFFVer] || 8;
|
||||
if(opts.biff == 8 && val.BIFFVer == 0 && val.dt == 16) opts.biff = 2;
|
||||
if(file_depth++) break;
|
||||
cell_valid = true;
|
||||
out = ((options.dense ? [] : {}));
|
||||
|
26
dist/xlsx.full.min.js
generated
vendored
26
dist/xlsx.full.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/xlsx.full.min.map
generated
vendored
2
dist/xlsx.full.min.map
generated
vendored
File diff suppressed because one or more lines are too long
20
dist/xlsx.js
generated
vendored
20
dist/xlsx.js
generated
vendored
@ -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.13.3';
|
||||
XLSX.version = '0.13.4';
|
||||
var current_codepage = 1200, current_ansi = 1252;
|
||||
/*global cptable:true, window */
|
||||
if(typeof module !== "undefined" && typeof require !== 'undefined') {
|
||||
@ -2146,11 +2146,13 @@ function parsexmltag(tag, skip_root) {
|
||||
if(j===q.length) {
|
||||
if(q.indexOf("_") > 0) q = q.slice(0, q.indexOf("_")); // from ods
|
||||
z[q] = v;
|
||||
z[q.toLowerCase()] = v;
|
||||
}
|
||||
else {
|
||||
var k = (j===5 && q.slice(0,5)==="xmlns"?"xmlns":"")+q.slice(j+1);
|
||||
if(z[k] && q.slice(j-3,j) == "ext") continue; // from ods
|
||||
z[k] = v;
|
||||
z[k.toLowerCase()] = v;
|
||||
}
|
||||
}
|
||||
return z;
|
||||
@ -2856,6 +2858,8 @@ function sheet_add_aoa(_ws, data, opts) {
|
||||
if(_R == -1) range.e.r = _R = _range.e.r + 1;
|
||||
}
|
||||
for(var R = 0; R != data.length; ++R) {
|
||||
if(!data[R]) continue;
|
||||
if(!Array.isArray(data[R])) throw new Error("aoa_to_sheet expects an array of arrays");
|
||||
for(var C = 0; C != data[R].length; ++C) {
|
||||
if(typeof data[R][C] === 'undefined') continue;
|
||||
var cell = ({v: data[R][C] });
|
||||
@ -6722,13 +6726,17 @@ var PRN = (function() {
|
||||
switch(opts.type) {
|
||||
case 'base64': str = Base64.decode(d); break;
|
||||
case 'binary': str = d; break;
|
||||
case 'buffer': str = d.toString('binary'); break;
|
||||
case 'buffer':
|
||||
if(opts.codepage == 65001) str = d.toString('utf8');
|
||||
else if(opts.codepage && typeof cptable !== 'undefined') str = cptable.utils.decode(opts.codepage, d);
|
||||
else str = d.toString('binary');
|
||||
break;
|
||||
case 'array': str = cc2str(d); break;
|
||||
case 'string': str = d; break;
|
||||
default: throw new Error("Unrecognized type " + opts.type);
|
||||
}
|
||||
if(bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) str = utf8read(str.slice(3));
|
||||
else if((opts.type == 'binary' || opts.type == 'buffer') && typeof cptable !== 'undefined' && opts.codepage) str = cptable.utils.decode(opts.codepage, cptable.utils.encode(1252,str));
|
||||
else if((opts.type == 'binary') && typeof cptable !== 'undefined' && opts.codepage) str = cptable.utils.decode(opts.codepage, cptable.utils.encode(1252,str));
|
||||
if(str.slice(0,19) == "socialcalc:version:") return ETH.to_sheet(opts.type == 'string' ? str : utf8read(str), opts);
|
||||
return prn_to_sheet_str(str, opts);
|
||||
}
|
||||
@ -6774,7 +6782,6 @@ function read_wb_ID(d, opts) {
|
||||
return PRN.to_workbook(d, opts);
|
||||
}
|
||||
}
|
||||
|
||||
var WK_ = (function() {
|
||||
function lotushopper(data, cb, opts) {
|
||||
if(!data) return;
|
||||
@ -12602,7 +12609,7 @@ function write_ws_xml(idx, opts, wb, rels) {
|
||||
/* customProperties */
|
||||
/* cellWatches */
|
||||
|
||||
o[o.length] = writetag("ignoredErrors", writextag("ignoredError", null, {numberStoredAsText:1, sqref:ref}));
|
||||
if(!opts || opts.ignoreEC || (opts.ignoreEC == (void 0))) o[o.length] = writetag("ignoredErrors", writextag("ignoredError", null, {numberStoredAsText:1, sqref:ref}));
|
||||
|
||||
/* smartTags */
|
||||
|
||||
@ -13475,7 +13482,7 @@ function write_ws_bin(idx, opts, wb, rels) {
|
||||
/* [COLBRK] */
|
||||
/* *BrtBigName */
|
||||
/* [CELLWATCHES] */
|
||||
write_IGNOREECS(ba, ws);
|
||||
if(!opts || opts.ignoreEC || (opts.ignoreEC == (void 0))) write_IGNOREECS(ba, ws);
|
||||
/* [SMARTTAGS] */
|
||||
/* [BrtDrawing] */
|
||||
write_LEGACYDRAWING(ba, ws, idx, rels);
|
||||
@ -15883,6 +15890,7 @@ wb.opts.Date1904 = Workbook.WBProps.date1904 = val; break;
|
||||
0x0002:2,
|
||||
0x0007:2
|
||||
}[val.BIFFVer] || 8;
|
||||
if(opts.biff == 8 && val.BIFFVer == 0 && val.dt == 16) opts.biff = 2;
|
||||
if(file_depth++) break;
|
||||
cell_valid = true;
|
||||
out = ((options.dense ? [] : {}));
|
||||
|
26
dist/xlsx.min.js
generated
vendored
26
dist/xlsx.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/xlsx.min.map
generated
vendored
2
dist/xlsx.min.map
generated
vendored
File diff suppressed because one or more lines are too long
@ -12,6 +12,7 @@ The exported `write` and `writeFile` functions accept an options argument:
|
||||
|`compression`| `false` | Use ZIP compression for ZIP-based formats ** |
|
||||
|`Props` | | Override workbook properties when writing ** |
|
||||
|`themeXLSX` | | Override theme XML when writing XLSX/XLSB/XLSM ** |
|
||||
|`ignoreEC` | `true` | Suppress "number as text" errors ** |
|
||||
|
||||
- `bookSST` is slower and more memory intensive, but has better compatibility
|
||||
with older versions of iOS Numbers
|
||||
@ -24,6 +25,9 @@ The exported `write` and `writeFile` functions accept an options argument:
|
||||
the [Workbook File Properties](#workbook-file-properties) section.
|
||||
- if specified, the string from `themeXLSX` will be saved as the primary theme
|
||||
for XLSX/XLSB/XLSM files (to `xl/theme/theme1.xml` in the ZIP)
|
||||
- Due to a bug in the program, some features like "Text to Columns" will crash
|
||||
Excel on worksheets where error conditions are ignored. The writer will mark
|
||||
files to ignore the error by default. Set `ignoreEC` to `false` to suppress.
|
||||
|
||||
### Supported Output Formats
|
||||
|
||||
|
@ -1656,6 +1656,7 @@ The exported `write` and `writeFile` functions accept an options argument:
|
||||
|`compression`| `false` | Use ZIP compression for ZIP-based formats ** |
|
||||
|`Props` | | Override workbook properties when writing ** |
|
||||
|`themeXLSX` | | Override theme XML when writing XLSX/XLSB/XLSM ** |
|
||||
|`ignoreEC` | `true` | Suppress "number as text" errors ** |
|
||||
|
||||
- `bookSST` is slower and more memory intensive, but has better compatibility
|
||||
with older versions of iOS Numbers
|
||||
@ -1668,6 +1669,9 @@ The exported `write` and `writeFile` functions accept an options argument:
|
||||
the [Workbook File Properties](#workbook-file-properties) section.
|
||||
- if specified, the string from `themeXLSX` will be saved as the primary theme
|
||||
for XLSX/XLSB/XLSM files (to `xl/theme/theme1.xml` in the ZIP)
|
||||
- Due to a bug in the program, some features like "Text to Columns" will crash
|
||||
Excel on worksheets where error conditions are ignored. The writer will mark
|
||||
files to ignore the error by default. Set `ignoreEC` to `false` to suppress.
|
||||
|
||||
### Supported Output Formats
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xlsx",
|
||||
"version": "0.13.3",
|
||||
"version": "0.13.4",
|
||||
"author": "sheetjs",
|
||||
"description": "SheetJS Spreadsheet data parser and writer",
|
||||
"keywords": [
|
||||
@ -65,6 +65,7 @@
|
||||
},
|
||||
"alex": {
|
||||
"allow": [
|
||||
"crash",
|
||||
"wtf",
|
||||
"holes"
|
||||
]
|
||||
|
1
test.js
1
test.js
@ -2094,6 +2094,7 @@ describe('HTML', function() {
|
||||
});
|
||||
if(domtest) it('should honor sheetRows', function() {
|
||||
var html = X.utils.sheet_to_html(X.utils.aoa_to_sheet([[1,2],[3,4],[5,6]]));
|
||||
// $FlowIgnore
|
||||
html = /<body[^>]*>([\s\S]*)<\/body>/i.exec(html)[1];
|
||||
var ws = X.utils.table_to_sheet(get_dom_element(html));
|
||||
assert.equal(ws['!ref'], "A1:B3");
|
||||
|
1
tests/core.js
generated
1
tests/core.js
generated
@ -2094,6 +2094,7 @@ describe('HTML', function() {
|
||||
});
|
||||
if(domtest) it('should honor sheetRows', function() {
|
||||
var html = X.utils.sheet_to_html(X.utils.aoa_to_sheet([[1,2],[3,4],[5,6]]));
|
||||
// $FlowIgnore
|
||||
html = /<body[^>]*>([\s\S]*)<\/body>/i.exec(html)[1];
|
||||
var ws = X.utils.table_to_sheet(get_dom_element(html));
|
||||
assert.equal(ws['!ref'], "A1:B3");
|
||||
|
6
types/index.d.ts
vendored
6
types/index.d.ts
vendored
@ -219,6 +219,12 @@ export interface WritingOptions extends CommonOptions {
|
||||
*/
|
||||
compression?: boolean;
|
||||
|
||||
/**
|
||||
* Suppress "number stored as text" errors in generated files
|
||||
* @default true
|
||||
*/
|
||||
ignoreEC?: boolean;
|
||||
|
||||
/** Override workbook properties on save */
|
||||
Props?: Properties;
|
||||
}
|
||||
|
18
xlsx.flow.js
18
xlsx.flow.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.13.3';
|
||||
XLSX.version = '0.13.4';
|
||||
var current_codepage = 1200, current_ansi = 1252;
|
||||
/*:: declare var cptable:any; */
|
||||
/*global cptable:true, window */
|
||||
@ -2947,6 +2947,8 @@ function sheet_add_aoa(_ws/*:?Worksheet*/, data/*:AOA*/, opts/*:?any*/)/*:Worksh
|
||||
if(_R == -1) range.e.r = _R = _range.e.r + 1;
|
||||
}
|
||||
for(var R = 0; R != data.length; ++R) {
|
||||
if(!data[R]) continue;
|
||||
if(!Array.isArray(data[R])) throw new Error("aoa_to_sheet expects an array of arrays");
|
||||
for(var C = 0; C != data[R].length; ++C) {
|
||||
if(typeof data[R][C] === 'undefined') continue;
|
||||
var cell/*:Cell*/ = ({v: data[R][C] }/*:any*/);
|
||||
@ -6818,13 +6820,17 @@ var PRN = (function() {
|
||||
switch(opts.type) {
|
||||
case 'base64': str = Base64.decode(d); break;
|
||||
case 'binary': str = d; break;
|
||||
case 'buffer': str = d.toString('binary'); break;
|
||||
case 'buffer':
|
||||
if(opts.codepage == 65001) str = d.toString('utf8');
|
||||
else if(opts.codepage && typeof cptable !== 'undefined') str = cptable.utils.decode(opts.codepage, d);
|
||||
else str = d.toString('binary');
|
||||
break;
|
||||
case 'array': str = cc2str(d); break;
|
||||
case 'string': str = d; break;
|
||||
default: throw new Error("Unrecognized type " + opts.type);
|
||||
}
|
||||
if(bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) str = utf8read(str.slice(3));
|
||||
else if((opts.type == 'binary' || opts.type == 'buffer') && typeof cptable !== 'undefined' && opts.codepage) str = cptable.utils.decode(opts.codepage, cptable.utils.encode(1252,str));
|
||||
else if((opts.type == 'binary') && typeof cptable !== 'undefined' && opts.codepage) str = cptable.utils.decode(opts.codepage, cptable.utils.encode(1252,str));
|
||||
if(str.slice(0,19) == "socialcalc:version:") return ETH.to_sheet(opts.type == 'string' ? str : utf8read(str), opts);
|
||||
return prn_to_sheet_str(str, opts);
|
||||
}
|
||||
@ -6870,7 +6876,6 @@ function read_wb_ID(d, opts) {
|
||||
return PRN.to_workbook(d, opts);
|
||||
}
|
||||
}
|
||||
|
||||
var WK_ = (function() {
|
||||
function lotushopper(data, cb/*:RecordHopperCB*/, opts/*:any*/) {
|
||||
if(!data) return;
|
||||
@ -12702,7 +12707,7 @@ function write_ws_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ {
|
||||
/* customProperties */
|
||||
/* cellWatches */
|
||||
|
||||
o[o.length] = writetag("ignoredErrors", writextag("ignoredError", null, {numberStoredAsText:1, sqref:ref}));
|
||||
if(!opts || opts.ignoreEC || (opts.ignoreEC == (void 0))) o[o.length] = writetag("ignoredErrors", writextag("ignoredError", null, {numberStoredAsText:1, sqref:ref}));
|
||||
|
||||
/* smartTags */
|
||||
|
||||
@ -13576,7 +13581,7 @@ function write_ws_bin(idx/*:number*/, opts, wb/*:Workbook*/, rels) {
|
||||
/* [COLBRK] */
|
||||
/* *BrtBigName */
|
||||
/* [CELLWATCHES] */
|
||||
write_IGNOREECS(ba, ws);
|
||||
if(!opts || opts.ignoreEC || (opts.ignoreEC == (void 0))) write_IGNOREECS(ba, ws);
|
||||
/* [SMARTTAGS] */
|
||||
/* [BrtDrawing] */
|
||||
write_LEGACYDRAWING(ba, ws, idx, rels);
|
||||
@ -15996,6 +16001,7 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
/*::[*/0x0002/*::]*/:2,
|
||||
/*::[*/0x0007/*::]*/:2
|
||||
}[val.BIFFVer] || 8;
|
||||
if(opts.biff == 8 && val.BIFFVer == 0 && val.dt == 16) opts.biff = 2;
|
||||
if(file_depth++) break;
|
||||
cell_valid = true;
|
||||
out = ((options.dense ? [] : {})/*:any*/);
|
||||
|
18
xlsx.js
generated
18
xlsx.js
generated
@ -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.13.3';
|
||||
XLSX.version = '0.13.4';
|
||||
var current_codepage = 1200, current_ansi = 1252;
|
||||
/*global cptable:true, window */
|
||||
if(typeof module !== "undefined" && typeof require !== 'undefined') {
|
||||
@ -2858,6 +2858,8 @@ function sheet_add_aoa(_ws, data, opts) {
|
||||
if(_R == -1) range.e.r = _R = _range.e.r + 1;
|
||||
}
|
||||
for(var R = 0; R != data.length; ++R) {
|
||||
if(!data[R]) continue;
|
||||
if(!Array.isArray(data[R])) throw new Error("aoa_to_sheet expects an array of arrays");
|
||||
for(var C = 0; C != data[R].length; ++C) {
|
||||
if(typeof data[R][C] === 'undefined') continue;
|
||||
var cell = ({v: data[R][C] });
|
||||
@ -6724,13 +6726,17 @@ var PRN = (function() {
|
||||
switch(opts.type) {
|
||||
case 'base64': str = Base64.decode(d); break;
|
||||
case 'binary': str = d; break;
|
||||
case 'buffer': str = d.toString('binary'); break;
|
||||
case 'buffer':
|
||||
if(opts.codepage == 65001) str = d.toString('utf8');
|
||||
else if(opts.codepage && typeof cptable !== 'undefined') str = cptable.utils.decode(opts.codepage, d);
|
||||
else str = d.toString('binary');
|
||||
break;
|
||||
case 'array': str = cc2str(d); break;
|
||||
case 'string': str = d; break;
|
||||
default: throw new Error("Unrecognized type " + opts.type);
|
||||
}
|
||||
if(bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) str = utf8read(str.slice(3));
|
||||
else if((opts.type == 'binary' || opts.type == 'buffer') && typeof cptable !== 'undefined' && opts.codepage) str = cptable.utils.decode(opts.codepage, cptable.utils.encode(1252,str));
|
||||
else if((opts.type == 'binary') && typeof cptable !== 'undefined' && opts.codepage) str = cptable.utils.decode(opts.codepage, cptable.utils.encode(1252,str));
|
||||
if(str.slice(0,19) == "socialcalc:version:") return ETH.to_sheet(opts.type == 'string' ? str : utf8read(str), opts);
|
||||
return prn_to_sheet_str(str, opts);
|
||||
}
|
||||
@ -6776,7 +6782,6 @@ function read_wb_ID(d, opts) {
|
||||
return PRN.to_workbook(d, opts);
|
||||
}
|
||||
}
|
||||
|
||||
var WK_ = (function() {
|
||||
function lotushopper(data, cb, opts) {
|
||||
if(!data) return;
|
||||
@ -12604,7 +12609,7 @@ function write_ws_xml(idx, opts, wb, rels) {
|
||||
/* customProperties */
|
||||
/* cellWatches */
|
||||
|
||||
o[o.length] = writetag("ignoredErrors", writextag("ignoredError", null, {numberStoredAsText:1, sqref:ref}));
|
||||
if(!opts || opts.ignoreEC || (opts.ignoreEC == (void 0))) o[o.length] = writetag("ignoredErrors", writextag("ignoredError", null, {numberStoredAsText:1, sqref:ref}));
|
||||
|
||||
/* smartTags */
|
||||
|
||||
@ -13477,7 +13482,7 @@ function write_ws_bin(idx, opts, wb, rels) {
|
||||
/* [COLBRK] */
|
||||
/* *BrtBigName */
|
||||
/* [CELLWATCHES] */
|
||||
write_IGNOREECS(ba, ws);
|
||||
if(!opts || opts.ignoreEC || (opts.ignoreEC == (void 0))) write_IGNOREECS(ba, ws);
|
||||
/* [SMARTTAGS] */
|
||||
/* [BrtDrawing] */
|
||||
write_LEGACYDRAWING(ba, ws, idx, rels);
|
||||
@ -15885,6 +15890,7 @@ wb.opts.Date1904 = Workbook.WBProps.date1904 = val; break;
|
||||
0x0002:2,
|
||||
0x0007:2
|
||||
}[val.BIFFVer] || 8;
|
||||
if(opts.biff == 8 && val.BIFFVer == 0 && val.dt == 16) opts.biff = 2;
|
||||
if(file_depth++) break;
|
||||
cell_valid = true;
|
||||
out = ((options.dense ? [] : {}));
|
||||
|
Loading…
Reference in New Issue
Block a user