forked from sheetjs/sheetjs
version bump 0.15.6: niggles from 2012
- CFB prevent infinite loop (h/t @rossj) - pass updated eslint checks (fixes #1726 h/t @BjoernRave) - defined name proper encoding (fixes #1785 h/t @laohe98) - correct theme color order (fixes #389 h/t @foreverpw) - ODS / XLML more aggressive flagging of stub cells - cellStyles implies sheetStubs - updated SSF to 0.10.3
This commit is contained in:
parent
a81bb78f18
commit
0a57229d3b
33
CHANGELOG.md
33
CHANGELOG.md
@ -4,6 +4,39 @@ This log is intended to keep track of backwards-incompatible changes, including
|
||||
but not limited to API changes and file location changes. Minor behavioral
|
||||
changes may not be included if they are not expected to break existing code.
|
||||
|
||||
## v0.15.6
|
||||
|
||||
* CFB prevent infinite loop
|
||||
* ODS empty cells marked as stub (type "z")
|
||||
* `cellStyles` option implies `sheetStubs`
|
||||
|
||||
## v0.15.5
|
||||
|
||||
* `sheets` parse option to specify which sheets to parse
|
||||
|
||||
## v0.15.4
|
||||
|
||||
* AOA utilities properly preserve number formats
|
||||
* Number formats captured in stub cells
|
||||
|
||||
## v0.15.3
|
||||
|
||||
* Properties and Custom Properties properly XML-encoded
|
||||
|
||||
## v0.15.2
|
||||
|
||||
- `sheet_get_cell` utility function
|
||||
- `sheet_to_json` explicitly support `null` as alias for default behavior
|
||||
- `encode_col` throw on negative column index
|
||||
- HTML properly handle whitespace around tags in a run
|
||||
- HTML use `id` option on write
|
||||
- Files starting with `0x09` followed by a display character are now TSV files
|
||||
- XLS parse references col/row indices mod by the correct number for BIFF ver
|
||||
- XLSX comments moved to avoid overlapping cell
|
||||
- XLSB outline level
|
||||
- AutoFilter update `_FilterDatabase` defined name on write
|
||||
- XLML skip CDATA blocks
|
||||
|
||||
## v0.15.1 (2019-08-14)
|
||||
|
||||
* XLSX ignore XML artifacts
|
||||
|
13
bin/xlsx.njs
13
bin/xlsx.njs
@ -137,6 +137,7 @@ if(program.all) {
|
||||
opts.sheetStubs = true;
|
||||
opts.cellDates = true;
|
||||
wopts.cellStyles = true;
|
||||
wopts.sheetStubs = true;
|
||||
wopts.bookVBA = true;
|
||||
}
|
||||
if(program.sparse) opts.dense = false; else opts.dense = true;
|
||||
@ -165,26 +166,26 @@ if(program.dump) {
|
||||
process.exit(0);
|
||||
}
|
||||
if(program.props) {
|
||||
dump_props(wb);
|
||||
if(wb) dump_props(wb);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
/* full workbook formats */
|
||||
workbook_formats.forEach(function(m) { if(program[m[0]] || isfmt(m[0])) {
|
||||
wopts.bookType = m[1];
|
||||
X.writeFile(wb, program.output || sheetname || ((filename || "") + "." + m[2]), wopts);
|
||||
if(wb) X.writeFile(wb, program.output || sheetname || ((filename || "") + "." + m[2]), wopts);
|
||||
process.exit(0);
|
||||
} });
|
||||
|
||||
wb_formats_2.forEach(function(m) { if(program[m[0]] || isfmt(m[0])) {
|
||||
wopts.bookType = m[1];
|
||||
X.writeFile(wb, program.output || sheetname || ((filename || "") + "." + m[2]), wopts);
|
||||
if(wb) X.writeFile(wb, program.output || sheetname || ((filename || "") + "." + m[2]), wopts);
|
||||
process.exit(0);
|
||||
} });
|
||||
|
||||
var target_sheet = sheetname || '';
|
||||
if(target_sheet === '') {
|
||||
if(program.sheetIndex < (wb.SheetNames||[]).length) target_sheet = wb.SheetNames[program.sheetIndex];
|
||||
if(+program.sheetIndex < (wb.SheetNames||[]).length) target_sheet = wb.SheetNames[+program.sheetIndex];
|
||||
else target_sheet = (wb.SheetNames||[""])[0];
|
||||
}
|
||||
|
||||
@ -269,13 +270,13 @@ function dump_props(wb/*:Workbook*/) {
|
||||
if(wb.Props) {
|
||||
Keys = Object.keys(wb.Props);
|
||||
for(pi = 0; pi < Keys.length; ++pi) {
|
||||
if(Keys.hasOwnProperty(Keys[pi])) propaoa.push([Keys[pi], Keys[/*::+*/Keys[pi]]]);
|
||||
if(Object.prototype.hasOwnProperty.call(Keys, Keys[pi])) propaoa.push([Keys[pi], Keys[/*::+*/Keys[pi]]]);
|
||||
}
|
||||
}
|
||||
if(wb.Custprops) {
|
||||
Keys = Object.keys(wb.Custprops);
|
||||
for(pi = 0; pi < Keys.length; ++pi) {
|
||||
if(Keys.hasOwnProperty(Keys[pi])) propaoa.push([Keys[pi], Keys[/*::+*/Keys[pi]]]);
|
||||
if(Object.prototype.hasOwnProperty.call(Keys, Keys[pi])) propaoa.push([Keys[pi], Keys[/*::+*/Keys[pi]]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
XLSX.version = '0.15.5';
|
||||
XLSX.version = '0.15.6';
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*jshint -W041 */
|
||||
var SSF/*:SSFModule*/ = ({}/*:any*/);
|
||||
var make_ssf = function make_ssf(SSF/*:SSFModule*/){
|
||||
SSF.version = '0.10.2';
|
||||
SSF.version = '0.10.3';
|
||||
function _strrev(x/*:string*/)/*:string*/ { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; }
|
||||
function fill(c/*:string*/,l/*:number*/)/*:string*/ { var o = ""; while(o.length < l) o+=c; return o; }
|
||||
function pad0(v/*:any*/,d/*:number*/)/*:string*/{var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;}
|
||||
@ -169,7 +169,7 @@ function general_fmt(v/*:any*/, opts/*:any*/) {
|
||||
switch(typeof v) {
|
||||
case 'string': return v;
|
||||
case 'boolean': return v ? "TRUE" : "FALSE";
|
||||
case 'number': return (v|0) === v ? general_fmt_int(v) : general_fmt_num(v);
|
||||
case 'number': return (v|0) === v ? v.toString(10) : general_fmt_num(v);
|
||||
case 'undefined': return "";
|
||||
case 'object':
|
||||
if(v == null) return "";
|
||||
@ -552,7 +552,7 @@ function fmt_is_date(fmt/*:string*/)/*:boolean*/ {
|
||||
while(i < fmt.length) {
|
||||
switch((c = fmt.charAt(i))) {
|
||||
case 'G': if(isgeneral(fmt, i)) i+= 6; i++; break;
|
||||
case '"': for(;(/*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;) ++i; ++i; break;
|
||||
case '"': for(;(/*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;){/*empty*/} ++i; break;
|
||||
case '\\': i+=2; break;
|
||||
case '_': i+=2; break;
|
||||
case '@': ++i; break;
|
||||
@ -661,6 +661,7 @@ function eval_fmt(fmt/*:string*/, v/*:any*/, opts/*:any*/, flen/*:number*/) {
|
||||
o = c; while(i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1) o+=fmt.charAt(i);
|
||||
out[out.length] = {t:'D', v:o}; break;
|
||||
case ' ': out[out.length] = {t:c, v:c}; ++i; break;
|
||||
case "$": out[out.length] = {t:'t', v:'$'}; ++i; break;
|
||||
default:
|
||||
if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized character ' + c + ' in ' + fmt);
|
||||
out[out.length] = {t:'t', v:c}; ++i; break;
|
||||
|
@ -21,7 +21,7 @@ declare var new_unsafe_buf:any;
|
||||
/* vim: set ts=2: */
|
||||
/*jshint eqnull:true */
|
||||
/*exported CFB */
|
||||
/*global module, require:false, process:false, Buffer:false, Uint8Array:false, Uint16Array:false */
|
||||
/*global Uint8Array:false, Uint16Array:false */
|
||||
|
||||
/*::
|
||||
declare var DO_NOT_EXPORT_CFB:?boolean;
|
||||
@ -142,7 +142,7 @@ CRC32.str = crc32_str;
|
||||
/* [MS-CFB] v20171201 */
|
||||
var CFB = (function _CFB(){
|
||||
var exports/*:CFBModule*/ = /*::(*/{}/*:: :any)*/;
|
||||
exports.version = '1.1.3';
|
||||
exports.version = '1.1.4';
|
||||
/* [MS-CFB] 2.6.4 */
|
||||
function namecmp(l/*:string*/, r/*:string*/)/*:number*/ {
|
||||
var L = l.split("/"), R = r.split("/");
|
||||
@ -473,7 +473,9 @@ function make_sector_list(sectors/*:Array<RawBytes>*/, dir_start/*:number*/, fat
|
||||
k = (i + dir_start); if(k >= sl) k-=sl;
|
||||
if(chkd[k]) continue;
|
||||
buf_chain = [];
|
||||
var seen = [];
|
||||
for(j=k; j>=0;) {
|
||||
seen[j] = true;
|
||||
chkd[j] = true;
|
||||
buf[buf.length] = j;
|
||||
buf_chain.push(sectors[j]);
|
||||
@ -482,6 +484,7 @@ function make_sector_list(sectors/*:Array<RawBytes>*/, dir_start/*:number*/, fat
|
||||
if(ssz < 4 + jj) throw new Error("FAT boundary crossed: " + j + " 4 "+ssz);
|
||||
if(!sectors[addr]) break;
|
||||
j = __readInt32LE(sectors[addr], jj);
|
||||
if(seen[j]) break;
|
||||
}
|
||||
sector_list[k] = ({nodes: buf, data:__toBuffer([buf_chain])}/*:SectorEntry*/);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ function blobify(data) {
|
||||
}
|
||||
/* write or download file */
|
||||
function write_dl(fname/*:string*/, payload/*:any*/, enc/*:?string*/) {
|
||||
/*global IE_SaveFile, Blob, navigator, saveAs, URL, document, File, chrome */
|
||||
/*global IE_SaveFile, Blob, navigator, saveAs, document, File, chrome */
|
||||
if(typeof _fs !== 'undefined' && _fs.writeFileSync) return enc ? _fs.writeFileSync(fname, payload, enc) : _fs.writeFileSync(fname, payload);
|
||||
var data = (enc == "utf8") ? utf8write(payload) : payload;
|
||||
/*:: declare var IE_SaveFile: any; */
|
||||
|
@ -1,6 +1,6 @@
|
||||
function keys(o/*:any*/)/*:Array<any>*/ {
|
||||
var ks = Object.keys(o), o2 = [];
|
||||
for(var i = 0; i < ks.length; ++i) if(o.hasOwnProperty(ks[i])) o2.push(ks[i]);
|
||||
for(var i = 0; i < ks.length; ++i) if(Object.prototype.hasOwnProperty.call(o, ks[i])) o2.push(ks[i]);
|
||||
return o2;
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ function dup(o/*:any*/)/*:any*/ {
|
||||
if(typeof o != 'object' || o == null) return o;
|
||||
if(o instanceof Date) return new Date(o.getTime());
|
||||
var out = {};
|
||||
for(var k in o) if(o.hasOwnProperty(k)) out[k] = dup(o[k]);
|
||||
for(var k in o) if(Object.prototype.hasOwnProperty.call(o, k)) out[k] = dup(o[k]);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ var rencoding = evert(encodings);
|
||||
// TODO: CP remap (need to read file version to determine OS)
|
||||
var unescapexml/*:StringConv*/ = (function() {
|
||||
/* 22.4.2.4 bstr (Basic String) */
|
||||
var encregex = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/g, coderegex = /_x([\da-fA-F]{4})_/g;
|
||||
var encregex = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/ig, coderegex = /_x([\da-fA-F]{4})_/ig;
|
||||
return function unescapexml(text/*:string*/)/*:string*/ {
|
||||
var s = text + '', i = s.indexOf("<![CDATA[");
|
||||
if(i == -1) return s.replace(encregex, function($$, $1) { return encodings[$$]||String.fromCharCode(parseInt($1,$$.indexOf("x")>-1?16:10))||$$; }).replace(coderegex,function(m,c) {return String.fromCharCode(parseInt(c,16));});
|
||||
@ -175,7 +175,7 @@ var htmldecode/*:{(s:string):string}*/ = (function() {
|
||||
var entities/*:Array<[RegExp, string]>*/ = [
|
||||
['nbsp', ' '], ['middot', '·'],
|
||||
['quot', '"'], ['apos', "'"], ['gt', '>'], ['lt', '<'], ['amp', '&']
|
||||
].map(function(x/*:[string, string]*/) { return [new RegExp('&' + x[0] + ';', "g"), x[1]]; });
|
||||
].map(function(x/*:[string, string]*/) { return [new RegExp('&' + x[0] + ';', "ig"), x[1]]; });
|
||||
return function htmldecode(str/*:string*/)/*:string*/ {
|
||||
var o = str
|
||||
// Remove new lines and spaces from start of content
|
||||
|
@ -38,7 +38,7 @@ function encode_range_xls(r, opts)/*:string*/ {
|
||||
}
|
||||
}
|
||||
if(r.s.c == 0 && !r.s.cRel) {
|
||||
if(r.e.c == (opts.biff >= 12 ? 0xFFFF : 0xFF) && !r.e.cRel) {
|
||||
if(r.e.c == (opts.biff >= 12 ? 0x3FFF : 0xFF) && !r.e.cRel) {
|
||||
return (r.s.rRel ? "" : "$") + encode_row(r.s.r) + ":" + (r.e.rRel ? "" : "$") + encode_row(r.e.r);
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,12 @@ function write_XLWideString(data/*:string*/, o) {
|
||||
return _null ? o.slice(0, o.l) : o;
|
||||
}
|
||||
|
||||
/* [MS-XLSB] 2.5.91 */
|
||||
//function parse_LPWideString(data/*::, length*/)/*:string*/ {
|
||||
// var cchCharacters = data.read_shift(2);
|
||||
// return cchCharacters === 0 ? "" : data.read_shift(cchCharacters, "utf16le");
|
||||
//}
|
||||
|
||||
/* [MS-XLSB] 2.5.143 */
|
||||
function parse_StrRun(data) {
|
||||
return { ich: data.read_shift(2), ifnt: data.read_shift(2) };
|
||||
@ -149,6 +155,25 @@ function write_RfX(r/*:Range*/, o) {
|
||||
var parse_UncheckedRfX = parse_RfX;
|
||||
var write_UncheckedRfX = write_RfX;
|
||||
|
||||
/* [MS-XLSB] 2.5.155 UncheckedSqRfX */
|
||||
//function parse_UncheckedSqRfX(data) {
|
||||
// var cnt = data.read_shift(4);
|
||||
// var out = [];
|
||||
// for(var i = 0; i < cnt; ++i) {
|
||||
// var rng = parse_UncheckedRfX(data);
|
||||
// out.push(encode_range(rng));
|
||||
// }
|
||||
// return out.join(",");
|
||||
//}
|
||||
//function write_UncheckedSqRfX(sqrfx/*:string*/) {
|
||||
// var parts = sqrfx.split(/\s*,\s*/);
|
||||
// var o = new_buf(4); o.write_shift(4, parts.length);
|
||||
// var out = [o];
|
||||
// parts.forEach(function(rng) {
|
||||
// out.push(write_UncheckedRfX(safe_decode_range(rng)));
|
||||
// });
|
||||
// return bconcat(out);
|
||||
//}
|
||||
|
||||
/* [MS-XLS] 2.5.342 ; [MS-XLSB] 2.5.171 */
|
||||
/* TODO: error checking, NaN and Infinity values are not valid Xnum */
|
||||
|
@ -101,7 +101,7 @@ var SpecialProperties = {
|
||||
};
|
||||
|
||||
(function() {
|
||||
for(var y in SpecialProperties) if(SpecialProperties.hasOwnProperty(y))
|
||||
for(var y in SpecialProperties) if(Object.prototype.hasOwnProperty.call(SpecialProperties, y))
|
||||
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
|
||||
})();
|
||||
|
||||
|
@ -63,7 +63,7 @@ function xlml_write_custprops(Props, Custprops/*::, opts*/) {
|
||||
var o/*:Array<string>*/ = [];
|
||||
if(Props) keys(Props).forEach(function(k) {
|
||||
/*:: if(!Props) return; */
|
||||
if(!Props.hasOwnProperty(k)) return;
|
||||
if(!Object.prototype.hasOwnProperty.call(Props, k)) return;
|
||||
for(var i = 0; i < CORE_PROPS.length; ++i) if(k == CORE_PROPS[i][1]) return;
|
||||
for(i = 0; i < EXT_PROPS.length; ++i) if(k == EXT_PROPS[i][1]) return;
|
||||
for(i = 0; i < BLACKLIST.length; ++i) if(k == BLACKLIST[i]) return;
|
||||
@ -77,8 +77,8 @@ function xlml_write_custprops(Props, Custprops/*::, opts*/) {
|
||||
});
|
||||
if(Custprops) keys(Custprops).forEach(function(k) {
|
||||
/*:: if(!Custprops) return; */
|
||||
if(!Custprops.hasOwnProperty(k)) return;
|
||||
if(Props && Props.hasOwnProperty(k)) return;
|
||||
if(!Object.prototype.hasOwnProperty.call(Custprops, k)) return;
|
||||
if(Props && Object.prototype.hasOwnProperty.call(Props, k)) return;
|
||||
var m = Custprops[k];
|
||||
var t = "string";
|
||||
if(typeof m == 'number') { t = "float"; m = String(m); }
|
||||
|
@ -349,7 +349,7 @@ function write_Window1(/*::opts*/) {
|
||||
}
|
||||
/* [MS-XLS] 2.4.346 TODO */
|
||||
function parse_Window2(blob, length, opts) {
|
||||
if(opts && opts.biff >= 2 && opts.biff < 8) return {};
|
||||
if(opts && opts.biff >= 2 && opts.biff < 5) return {};
|
||||
var f = blob.read_shift(2);
|
||||
return { RTL: f & 0x40 };
|
||||
}
|
||||
|
@ -790,13 +790,13 @@ var PRN = (function() {
|
||||
}
|
||||
|
||||
cc = [];
|
||||
for(end in cnt) if ( cnt.hasOwnProperty(end) ) {
|
||||
for(end in cnt) if ( Object.prototype.hasOwnProperty.call(cnt, end) ) {
|
||||
cc.push([ cnt[end], end ]);
|
||||
}
|
||||
|
||||
if ( !cc.length ) {
|
||||
cnt = guess_sep_weights;
|
||||
for(end in cnt) if ( cnt.hasOwnProperty(end) ) {
|
||||
for(end in cnt) if ( Object.prototype.hasOwnProperty.call(cnt, end) ) {
|
||||
cc.push([ cnt[end], end ]);
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ function parse_fonts(t, styles, themes, opts) {
|
||||
break;
|
||||
|
||||
/* 18.8.29 name CT_FontName */
|
||||
case '<name': if(y.val) font.name = y.val; break;
|
||||
case '<name': if(y.val) font.name = utf8read(y.val); break;
|
||||
case '<name/>': case '</name>': break;
|
||||
|
||||
/* 18.8.2 b CT_BooleanProperty */
|
||||
@ -396,11 +396,11 @@ return function parse_sty_xml(data, themes, opts) {
|
||||
if((t=data.match(bordersRegex))) parse_borders(t, styles, themes, opts);
|
||||
|
||||
/* 18.8.9 cellStyleXfs CT_CellStyleXfs ? */
|
||||
/* 18.8.8 cellStyles CT_CellStyles ? */
|
||||
|
||||
/* 18.8.10 cellXfs CT_CellXfs ? */
|
||||
if((t=data.match(cellXfRegex))) parse_cellXfs(t, styles, opts);
|
||||
|
||||
/* 18.8.8 cellStyles CT_CellStyles ? */
|
||||
/* 18.8.15 dxfs CT_Dxfs ? */
|
||||
/* 18.8.42 tableStyles CT_TableStyles ? */
|
||||
/* 18.8.11 colors CT_Colors ? */
|
||||
|
@ -1,5 +1,12 @@
|
||||
RELS.THEME = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";
|
||||
|
||||
/* Even though theme layout is dk1 lt1 dk2 lt2, true order is lt1 dk1 lt2 dk2 */
|
||||
var XLSXThemeClrScheme = [
|
||||
'</a:lt1>', '</a:dk1>', '</a:lt2>', '</a:dk2>',
|
||||
'</a:accent1>', '</a:accent2>', '</a:accent3>',
|
||||
'</a:accent4>', '</a:accent5>', '</a:accent6>',
|
||||
'</a:hlink>', '</a:folHlink>'
|
||||
];
|
||||
/* 20.1.6.2 clrScheme CT_ColorScheme */
|
||||
function parse_clrScheme(t, themes, opts) {
|
||||
themes.themeElements.clrScheme = [];
|
||||
@ -43,7 +50,7 @@ function parse_clrScheme(t, themes, opts) {
|
||||
case '<a:hlink>': case '</a:hlink>':
|
||||
case '<a:folHlink>': case '</a:folHlink>':
|
||||
if (y[0].charAt(1) === '/') {
|
||||
themes.themeElements.clrScheme.push(color);
|
||||
themes.themeElements.clrScheme[XLSXThemeClrScheme.indexOf(y[0])] = color;
|
||||
color = {};
|
||||
} else {
|
||||
color.name = y[0].slice(3, y[0].length - 1);
|
||||
|
@ -23,7 +23,7 @@ var rc_to_a1 = (function(){
|
||||
};
|
||||
})();
|
||||
|
||||
var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)([1-9]\d{0,5}|10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6])(?![_.\(A-Za-z0-9])/g;
|
||||
var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})(?![_.\(A-Za-z0-9])/g;
|
||||
var a1_to_rc =(function(){
|
||||
return function a1_to_rc(fstr/*:string*/, base/*:CellAddress*/) {
|
||||
return fstr.replace(crefregex, function($0, $1, $2, $3, $4, $5) {
|
||||
|
@ -12,7 +12,7 @@ var browser_has_Map = typeof Map !== 'undefined';
|
||||
function get_sst_id(sst/*:SST*/, str/*:string*/, rev)/*:number*/ {
|
||||
var i = 0, len = sst.length;
|
||||
if(rev) {
|
||||
if(browser_has_Map ? rev.has(str) : rev.hasOwnProperty(str)) {
|
||||
if(browser_has_Map ? rev.has(str) : Object.prototype.hasOwnProperty.call(rev, str)) {
|
||||
var revarr = browser_has_Map ? rev.get(str) : rev[str];
|
||||
for(; i < revarr.length; ++i) {
|
||||
if(sst[revarr[i]].t === str) { sst.Count ++; return revarr[i]; }
|
||||
@ -27,7 +27,7 @@ function get_sst_id(sst/*:SST*/, str/*:string*/, rev)/*:number*/ {
|
||||
if(!rev.has(str)) rev.set(str, []);
|
||||
rev.get(str).push(len);
|
||||
} else {
|
||||
if(!rev.hasOwnProperty(str)) rev[str] = [];
|
||||
if(!Object.prototype.hasOwnProperty.call(rev, str)) rev[str] = [];
|
||||
rev[str].push(len);
|
||||
}
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ function write_wb_xml(wb/*:Workbook*//*::, opts:?WriteOpts*/)/*:string*/ {
|
||||
if(n.Sheet != null) d.localSheetId = ""+n.Sheet;
|
||||
if(n.Hidden) d.hidden = "1";
|
||||
if(!n.Ref) return;
|
||||
o[o.length] = writextag('definedName', String(n.Ref).replace(/</g, "<").replace(/>/g, ">"), d);
|
||||
o[o.length] = writextag('definedName', escapexml(n.Ref), d);
|
||||
});
|
||||
o[o.length] = "</definedNames>";
|
||||
}
|
||||
|
@ -122,7 +122,10 @@ function parse_xlml_data(xml, ss, data, cell/*:any*/, base, styles, csty, row, a
|
||||
if(!cell.t) cell.t = 'n';
|
||||
break;
|
||||
case 'Error': cell.t = 'e'; cell.v = RBErr[xml]; if(o.cellText !== false) cell.w = xml; break;
|
||||
default: cell.t = 's'; cell.v = xlml_fixstr(ss||xml); break;
|
||||
default:
|
||||
if(xml == "" && ss == "") { cell.t = 'z'; }
|
||||
else { cell.t = 's'; cell.v = xlml_fixstr(ss||xml); }
|
||||
break;
|
||||
}
|
||||
safe_format_xlml(cell, nf, o);
|
||||
if(o.cellFormula !== false) {
|
||||
@ -913,7 +916,9 @@ function write_sty_xlml(wb, opts)/*:string*/ {
|
||||
opts.cellXfs.forEach(function(xf, id) {
|
||||
var payload/*:Array<string>*/ = [];
|
||||
payload.push(writextag('NumberFormat', null, {"ss:Format": escapexml(SSF._table[xf.numFmtId])}));
|
||||
styles.push(writextag('Style', payload.join(""), {"ss:ID": "s" + (21+id)}));
|
||||
|
||||
var o = /*::(*/{"ss:ID": "s" + (21+id)}/*:: :any)*/;
|
||||
styles.push(writextag('Style', payload.join(""), o));
|
||||
});
|
||||
return writextag("Styles", styles.join(""));
|
||||
}
|
||||
|
@ -887,12 +887,12 @@ function write_xls_props(wb/*:Workbook*/, cfb/*:CFBContainer*/) {
|
||||
if(wb.Props) {
|
||||
Keys = keys(wb.Props);
|
||||
// $FlowIgnore
|
||||
for(i = 0; i < Keys.length; ++i) (DocSummaryRE.hasOwnProperty(Keys[i]) ? DSEntries : SummaryRE.hasOwnProperty(Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Props[Keys[i]]]);
|
||||
for(i = 0; i < Keys.length; ++i) (Object.prototype.hasOwnProperty.call(DocSummaryRE, Keys[i]) ? DSEntries : Object.prototype.hasOwnProperty.call(SummaryRE, Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Props[Keys[i]]]);
|
||||
}
|
||||
if(wb.Custprops) {
|
||||
Keys = keys(wb.Custprops);
|
||||
// $FlowIgnore
|
||||
for(i = 0; i < Keys.length; ++i) if(!(wb.Props||{}).hasOwnProperty(Keys[i])) (DocSummaryRE.hasOwnProperty(Keys[i]) ? DSEntries : SummaryRE.hasOwnProperty(Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Custprops[Keys[i]]]);
|
||||
for(i = 0; i < Keys.length; ++i) if(!Object.prototype.hasOwnProperty.call((wb.Props||{}), Keys[i])) (Object.prototype.hasOwnProperty.call(DocSummaryRE, Keys[i]) ? DSEntries : Object.prototype.hasOwnProperty.call(SummaryRE, Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Custprops[Keys[i]]]);
|
||||
}
|
||||
var CEntries2 = [];
|
||||
for(i = 0; i < CEntries.length; ++i) {
|
||||
|
@ -8,6 +8,29 @@ function write_biff_rec(ba/*:BufArray*/, type/*:number|string*/, payload, length
|
||||
if(/*:: len != null &&*/len > 0 && is_buf(payload)) ba.push(payload);
|
||||
}
|
||||
|
||||
//function write_biff_continue(ba/*:BufArray*/, type/*:number|string*/, payload, length/*:?number*/)/*:void*/ {
|
||||
// var len = length || (payload||[]).length || 0;
|
||||
// if(len <= 8224) return write_biff_rec(ba, type, payload, len);
|
||||
// var t/*:number*/ = +type || +XLSRE[/*::String(*/type/*::)*/];
|
||||
// if(isNaN(t)) return;
|
||||
// var parts = payload.parts || [], sidx = 0;
|
||||
// var i = 0, w = 0;
|
||||
// while(w + (parts[sidx] || 8224) <= 8224) { w+= (parts[sidx] || 8224); sidx++; }
|
||||
// var o = ba.next(4);
|
||||
// o.write_shift(2, t);
|
||||
// o.write_shift(2, w);
|
||||
// ba.push(payload.slice(i, i + w));
|
||||
// i += w;
|
||||
// while(i < len) {
|
||||
// o = ba.next(4);
|
||||
// o.write_shift(2, 0x3c); // TODO: figure out correct continue type
|
||||
// w = 0;
|
||||
// while(w + (parts[sidx] || 8224) <= 8224) { w+= (parts[sidx] || 8224); sidx++; }
|
||||
// o.write_shift(2, w);
|
||||
// ba.push(payload.slice(i, i+w)); i+= w;
|
||||
// }
|
||||
//}
|
||||
|
||||
function write_BIFF2Cell(out, r/*:number*/, c/*:number*/) {
|
||||
if(!out) out = new_buf(7);
|
||||
out.write_shift(2, r);
|
||||
|
@ -186,6 +186,7 @@ var parse_content_xml = (function() {
|
||||
if(atag.Target) q.l = atag;
|
||||
if(comments.length > 0) { q.c = comments; comments = []; }
|
||||
if(textp && opts.cellText !== false) q.w = textp;
|
||||
if(isstub) { q.t = "z"; delete q.v; }
|
||||
if(!isstub || opts.sheetStubs) {
|
||||
if(!(opts.sheetRows && opts.sheetRows <= R)) {
|
||||
for(var rpt = 0; rpt < rowpeat; ++rpt) {
|
||||
|
@ -112,6 +112,11 @@ var write_content_ods/*:{(wb:any, opts:any):string}*/ = (function() {
|
||||
o.push(' <number:text>/</number:text>\n');
|
||||
o.push(' <number:year/>\n');
|
||||
o.push(' </number:date-style>\n');
|
||||
|
||||
o.push(' <style:style style:name="ta1" style:family="table">\n'); // style:master-page-name="mp1">\n');
|
||||
o.push(' <style:table-properties table:display="true" style:writing-mode="lr-tb"/>\n');
|
||||
o.push(' </style:style>\n');
|
||||
|
||||
o.push(' <style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>\n');
|
||||
o.push(' </office:automatic-styles>\n');
|
||||
};
|
||||
|
@ -69,7 +69,7 @@ function readSync(data/*:RawData*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
|
||||
if(typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) return readSync(new Uint8Array(data), opts);
|
||||
var d = data, n = [0,0,0,0], str = false;
|
||||
var o = opts||{};
|
||||
if(o.cellStyles) { o.cellNF = true; }
|
||||
if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; }
|
||||
_ssfopts = {};
|
||||
if(o.dateNF) _ssfopts.dateNF = o.dateNF;
|
||||
if(!o.type) o.type = (has_buf && Buffer.isBuffer(data)) ? "buffer" : "base64";
|
||||
|
@ -9,7 +9,6 @@ function write_cfb_ctr(cfb/*:CFBContainer*/, o/*:WriteOpts*/)/*:any*/ {
|
||||
return CFB.write(cfb, o);
|
||||
}
|
||||
|
||||
/*global encrypt_agile */
|
||||
/*:: declare var encrypt_agile:any; */
|
||||
function write_zip_type(wb/*:Workbook*/, opts/*:?WriteOpts*/)/*:any*/ {
|
||||
var o = opts||{};
|
||||
@ -26,7 +25,9 @@ function write_zip_type(wb/*:Workbook*/, opts/*:?WriteOpts*/)/*:any*/ {
|
||||
default: throw new Error("Unrecognized type " + o.type);
|
||||
}
|
||||
var out = z.FullPaths ? CFB.write(z, {fileType:"zip", type: /*::(*/{"nodebuffer": "buffer", "string": "binary"}/*:: :any)*/[oopts.type] || oopts.type}) : z.generate(oopts);
|
||||
if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.password), o);
|
||||
/*jshint -W083 */
|
||||
if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.password), o); // eslint-disable-line no-undef
|
||||
/*jshint +W083 */
|
||||
if(o.type === "file") return write_dl(o.file, out);
|
||||
return o.type == "string" ? utf8read(/*::(*/out/*:: :any)*/) : out;
|
||||
}
|
||||
@ -87,7 +88,7 @@ function writeSync(wb/*:Workbook*/, opts/*:?WriteOpts*/) {
|
||||
reset_cp();
|
||||
check_wb(wb);
|
||||
var o = opts||{};
|
||||
if(o.cellStyles) { o.cellNF = true; }
|
||||
if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; }
|
||||
if(o.type == "array") { o.type = "binary"; var out/*:string*/ = (writeSync(wb, o)/*:any*/); o.type = "array"; return s2ab(out); }
|
||||
switch(o.bookType || 'xlsb') {
|
||||
case 'xml':
|
||||
|
@ -6,7 +6,7 @@ type MJRObject = {
|
||||
*/
|
||||
function make_json_row(sheet/*:Worksheet*/, r/*:Range*/, R/*:number*/, cols/*:Array<string>*/, header/*:number*/, hdr/*:Array<any>*/, dense/*:boolean*/, o/*:Sheet2JSONOpts*/)/*:MJRObject*/ {
|
||||
var rr = encode_row(R);
|
||||
var defval = o.defval, raw = o.raw || !o.hasOwnProperty("raw");
|
||||
var defval = o.defval, raw = o.raw || !Object.prototype.hasOwnProperty.call(o, "raw");
|
||||
var isempty = true;
|
||||
var row/*:any*/ = (header === 1) ? [] : {};
|
||||
if(header !== 1) {
|
||||
|
28
dist/xlsx.core.min.js
generated
vendored
28
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
141
dist/xlsx.extendscript.js
generated
vendored
141
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.15.5';
|
||||
XLSX.version = '0.15.6';
|
||||
var current_codepage = 1200, current_ansi = 1252;
|
||||
/*global cptable:true, window */
|
||||
if(typeof module !== "undefined" && typeof require !== 'undefined') {
|
||||
@ -9348,7 +9348,7 @@ var chr0 = /\u0000/g, chr1 = /[\u0001-\u0006]/g;
|
||||
/*jshint -W041 */
|
||||
var SSF = ({});
|
||||
var make_ssf = function make_ssf(SSF){
|
||||
SSF.version = '0.10.2';
|
||||
SSF.version = '0.10.3';
|
||||
function _strrev(x) { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; }
|
||||
function fill(c,l) { var o = ""; while(o.length < l) o+=c; return o; }
|
||||
function pad0(v,d){var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;}
|
||||
@ -9512,7 +9512,7 @@ function general_fmt(v, opts) {
|
||||
switch(typeof v) {
|
||||
case 'string': return v;
|
||||
case 'boolean': return v ? "TRUE" : "FALSE";
|
||||
case 'number': return (v|0) === v ? general_fmt_int(v) : general_fmt_num(v);
|
||||
case 'number': return (v|0) === v ? v.toString(10) : general_fmt_num(v);
|
||||
case 'undefined': return "";
|
||||
case 'object':
|
||||
if(v == null) return "";
|
||||
@ -9892,7 +9892,7 @@ function fmt_is_date(fmt) {
|
||||
while(i < fmt.length) {
|
||||
switch((c = fmt.charAt(i))) {
|
||||
case 'G': if(isgeneral(fmt, i)) i+= 6; i++; break;
|
||||
case '"': for(;(/*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;) ++i; ++i; break;
|
||||
case '"': for(;(/*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;){/*empty*/} ++i; break;
|
||||
case '\\': i+=2; break;
|
||||
case '_': i+=2; break;
|
||||
case '@': ++i; break;
|
||||
@ -10001,6 +10001,7 @@ function eval_fmt(fmt, v, opts, flen) {
|
||||
o = c; while(i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1) o+=fmt.charAt(i);
|
||||
out[out.length] = {t:'D', v:o}; break;
|
||||
case ' ': out[out.length] = {t:c, v:c}; ++i; break;
|
||||
case "$": out[out.length] = {t:'t', v:'$'}; ++i; break;
|
||||
default:
|
||||
if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized character ' + c + ' in ' + fmt);
|
||||
out[out.length] = {t:'t', v:c}; ++i; break;
|
||||
@ -10299,7 +10300,7 @@ var DO_NOT_EXPORT_CFB = true;
|
||||
/* vim: set ts=2: */
|
||||
/*jshint eqnull:true */
|
||||
/*exported CFB */
|
||||
/*global module, require:false, process:false, Buffer:false, Uint8Array:false, Uint16Array:false */
|
||||
/*global Uint8Array:false, Uint16Array:false */
|
||||
|
||||
/* crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
@ -10405,7 +10406,7 @@ CRC32.str = crc32_str;
|
||||
/* [MS-CFB] v20171201 */
|
||||
var CFB = (function _CFB(){
|
||||
var exports = {};
|
||||
exports.version = '1.1.3';
|
||||
exports.version = '1.1.4';
|
||||
/* [MS-CFB] 2.6.4 */
|
||||
function namecmp(l, r) {
|
||||
var L = l.split("/"), R = r.split("/");
|
||||
@ -10736,7 +10737,9 @@ function make_sector_list(sectors, dir_start, fat_addrs, ssz) {
|
||||
k = (i + dir_start); if(k >= sl) k-=sl;
|
||||
if(chkd[k]) continue;
|
||||
buf_chain = [];
|
||||
var seen = [];
|
||||
for(j=k; j>=0;) {
|
||||
seen[j] = true;
|
||||
chkd[j] = true;
|
||||
buf[buf.length] = j;
|
||||
buf_chain.push(sectors[j]);
|
||||
@ -10745,6 +10748,7 @@ function make_sector_list(sectors, dir_start, fat_addrs, ssz) {
|
||||
if(ssz < 4 + jj) throw new Error("FAT boundary crossed: " + j + " 4 "+ssz);
|
||||
if(!sectors[addr]) break;
|
||||
j = __readInt32LE(sectors[addr], jj);
|
||||
if(seen[j]) break;
|
||||
}
|
||||
sector_list[k] = ({nodes: buf, data:__toBuffer([buf_chain])});
|
||||
}
|
||||
@ -11745,7 +11749,7 @@ function blobify(data) {
|
||||
}
|
||||
/* write or download file */
|
||||
function write_dl(fname, payload, enc) {
|
||||
/*global IE_SaveFile, Blob, navigator, saveAs, URL, document, File, chrome */
|
||||
/*global IE_SaveFile, Blob, navigator, saveAs, document, File, chrome */
|
||||
if(typeof _fs !== 'undefined' && _fs.writeFileSync) return enc ? _fs.writeFileSync(fname, payload, enc) : _fs.writeFileSync(fname, payload);
|
||||
var data = (enc == "utf8") ? utf8write(payload) : payload;
|
||||
if(typeof IE_SaveFile !== 'undefined') return IE_SaveFile(data, fname);
|
||||
@ -11792,7 +11796,7 @@ function read_binary(path) {
|
||||
}
|
||||
function keys(o) {
|
||||
var ks = Object.keys(o), o2 = [];
|
||||
for(var i = 0; i < ks.length; ++i) if(o.hasOwnProperty(ks[i])) o2.push(ks[i]);
|
||||
for(var i = 0; i < ks.length; ++i) if(Object.prototype.hasOwnProperty.call(o, ks[i])) o2.push(ks[i]);
|
||||
return o2;
|
||||
}
|
||||
|
||||
@ -11897,7 +11901,7 @@ function dup(o) {
|
||||
if(typeof o != 'object' || o == null) return o;
|
||||
if(o instanceof Date) return new Date(o.getTime());
|
||||
var out = {};
|
||||
for(var k in o) if(o.hasOwnProperty(k)) out[k] = dup(o[k]);
|
||||
for(var k in o) if(Object.prototype.hasOwnProperty.call(o, k)) out[k] = dup(o[k]);
|
||||
return out;
|
||||
}
|
||||
|
||||
@ -12091,7 +12095,7 @@ var rencoding = evert(encodings);
|
||||
// TODO: CP remap (need to read file version to determine OS)
|
||||
var unescapexml = (function() {
|
||||
/* 22.4.2.4 bstr (Basic String) */
|
||||
var encregex = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/g, coderegex = /_x([\da-fA-F]{4})_/g;
|
||||
var encregex = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/ig, coderegex = /_x([\da-fA-F]{4})_/ig;
|
||||
return function unescapexml(text) {
|
||||
var s = text + '', i = s.indexOf("<![CDATA[");
|
||||
if(i == -1) return s.replace(encregex, function($$, $1) { return encodings[$$]||String.fromCharCode(parseInt($1,$$.indexOf("x")>-1?16:10))||$$; }).replace(coderegex,function(m,c) {return String.fromCharCode(parseInt(c,16));});
|
||||
@ -12218,7 +12222,7 @@ var htmldecode = (function() {
|
||||
var entities = [
|
||||
['nbsp', ' '], ['middot', '·'],
|
||||
['quot', '"'], ['apos', "'"], ['gt', '>'], ['lt', '<'], ['amp', '&']
|
||||
].map(function(x) { return [new RegExp('&' + x[0] + ';', "g"), x[1]]; });
|
||||
].map(function(x) { return [new RegExp('&' + x[0] + ';', "ig"), x[1]]; });
|
||||
return function htmldecode(str) {
|
||||
var o = str
|
||||
// Remove new lines and spaces from start of content
|
||||
@ -12653,7 +12657,7 @@ function encode_range_xls(r, opts) {
|
||||
}
|
||||
}
|
||||
if(r.s.c == 0 && !r.s.cRel) {
|
||||
if(r.e.c == (opts.biff >= 12 ? 0xFFFF : 0xFF) && !r.e.cRel) {
|
||||
if(r.e.c == (opts.biff >= 12 ? 0x3FFF : 0xFF) && !r.e.cRel) {
|
||||
return (r.s.rRel ? "" : "$") + encode_row(r.s.r) + ":" + (r.e.rRel ? "" : "$") + encode_row(r.e.r);
|
||||
}
|
||||
}
|
||||
@ -12851,6 +12855,12 @@ function write_XLWideString(data, o) {
|
||||
return _null ? o.slice(0, o.l) : o;
|
||||
}
|
||||
|
||||
/* [MS-XLSB] 2.5.91 */
|
||||
//function parse_LPWideString(data) {
|
||||
// var cchCharacters = data.read_shift(2);
|
||||
// return cchCharacters === 0 ? "" : data.read_shift(cchCharacters, "utf16le");
|
||||
//}
|
||||
|
||||
/* [MS-XLSB] 2.5.143 */
|
||||
function parse_StrRun(data) {
|
||||
return { ich: data.read_shift(2), ifnt: data.read_shift(2) };
|
||||
@ -12984,6 +12994,25 @@ function write_RfX(r, o) {
|
||||
var parse_UncheckedRfX = parse_RfX;
|
||||
var write_UncheckedRfX = write_RfX;
|
||||
|
||||
/* [MS-XLSB] 2.5.155 UncheckedSqRfX */
|
||||
//function parse_UncheckedSqRfX(data) {
|
||||
// var cnt = data.read_shift(4);
|
||||
// var out = [];
|
||||
// for(var i = 0; i < cnt; ++i) {
|
||||
// var rng = parse_UncheckedRfX(data);
|
||||
// out.push(encode_range(rng));
|
||||
// }
|
||||
// return out.join(",");
|
||||
//}
|
||||
//function write_UncheckedSqRfX(sqrfx) {
|
||||
// var parts = sqrfx.split(/\s*,\s*/);
|
||||
// var o = new_buf(4); o.write_shift(4, parts.length);
|
||||
// var out = [o];
|
||||
// parts.forEach(function(rng) {
|
||||
// out.push(write_UncheckedRfX(safe_decode_range(rng)));
|
||||
// });
|
||||
// return bconcat(out);
|
||||
//}
|
||||
|
||||
/* [MS-XLS] 2.5.342 ; [MS-XLSB] 2.5.171 */
|
||||
/* TODO: error checking, NaN and Infinity values are not valid Xnum */
|
||||
@ -13218,7 +13247,7 @@ var SpecialProperties = {
|
||||
};
|
||||
|
||||
(function() {
|
||||
for(var y in SpecialProperties) if(SpecialProperties.hasOwnProperty(y))
|
||||
for(var y in SpecialProperties) if(Object.prototype.hasOwnProperty.call(SpecialProperties, y))
|
||||
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
|
||||
})();
|
||||
|
||||
@ -14173,7 +14202,7 @@ function xlml_write_custprops(Props, Custprops) {
|
||||
var T = 'CustomDocumentProperties';
|
||||
var o = [];
|
||||
if(Props) keys(Props).forEach(function(k) {
|
||||
if(!Props.hasOwnProperty(k)) return;
|
||||
if(!Object.prototype.hasOwnProperty.call(Props, k)) return;
|
||||
for(var i = 0; i < CORE_PROPS.length; ++i) if(k == CORE_PROPS[i][1]) return;
|
||||
for(i = 0; i < EXT_PROPS.length; ++i) if(k == EXT_PROPS[i][1]) return;
|
||||
for(i = 0; i < BLACKLIST.length; ++i) if(k == BLACKLIST[i]) return;
|
||||
@ -14186,8 +14215,8 @@ if(!Props.hasOwnProperty(k)) return;
|
||||
o.push(writextag(escapexmltag(k), m, {"dt:dt":t}));
|
||||
});
|
||||
if(Custprops) keys(Custprops).forEach(function(k) {
|
||||
if(!Custprops.hasOwnProperty(k)) return;
|
||||
if(Props && Props.hasOwnProperty(k)) return;
|
||||
if(!Object.prototype.hasOwnProperty.call(Custprops, k)) return;
|
||||
if(Props && Object.prototype.hasOwnProperty.call(Props, k)) return;
|
||||
var m = Custprops[k];
|
||||
var t = "string";
|
||||
if(typeof m == 'number') { t = "float"; m = String(m); }
|
||||
@ -15152,7 +15181,7 @@ function write_Window1() {
|
||||
}
|
||||
/* [MS-XLS] 2.4.346 TODO */
|
||||
function parse_Window2(blob, length, opts) {
|
||||
if(opts && opts.biff >= 2 && opts.biff < 8) return {};
|
||||
if(opts && opts.biff >= 2 && opts.biff < 5) return {};
|
||||
var f = blob.read_shift(2);
|
||||
return { RTL: f & 0x40 };
|
||||
}
|
||||
@ -16654,13 +16683,13 @@ var PRN = (function() {
|
||||
}
|
||||
|
||||
cc = [];
|
||||
for(end in cnt) if ( cnt.hasOwnProperty(end) ) {
|
||||
for(end in cnt) if ( Object.prototype.hasOwnProperty.call(cnt, end) ) {
|
||||
cc.push([ cnt[end], end ]);
|
||||
}
|
||||
|
||||
if ( !cc.length ) {
|
||||
cnt = guess_sep_weights;
|
||||
for(end in cnt) if ( cnt.hasOwnProperty(end) ) {
|
||||
for(end in cnt) if ( Object.prototype.hasOwnProperty.call(cnt, end) ) {
|
||||
cc.push([ cnt[end], end ]);
|
||||
}
|
||||
}
|
||||
@ -18058,7 +18087,7 @@ function parse_fonts(t, styles, themes, opts) {
|
||||
break;
|
||||
|
||||
/* 18.8.29 name CT_FontName */
|
||||
case '<name': if(y.val) font.name = y.val; break;
|
||||
case '<name': if(y.val) font.name = utf8read(y.val); break;
|
||||
case '<name/>': case '</name>': break;
|
||||
|
||||
/* 18.8.2 b CT_BooleanProperty */
|
||||
@ -18297,11 +18326,11 @@ return function parse_sty_xml(data, themes, opts) {
|
||||
if((t=data.match(bordersRegex))) parse_borders(t, styles, themes, opts);
|
||||
|
||||
/* 18.8.9 cellStyleXfs CT_CellStyleXfs ? */
|
||||
/* 18.8.8 cellStyles CT_CellStyles ? */
|
||||
|
||||
/* 18.8.10 cellXfs CT_CellXfs ? */
|
||||
if((t=data.match(cellXfRegex))) parse_cellXfs(t, styles, opts);
|
||||
|
||||
/* 18.8.8 cellStyles CT_CellStyles ? */
|
||||
/* 18.8.15 dxfs CT_Dxfs ? */
|
||||
/* 18.8.42 tableStyles CT_TableStyles ? */
|
||||
/* 18.8.11 colors CT_Colors ? */
|
||||
@ -18725,6 +18754,13 @@ function write_sty_bin(wb, opts) {
|
||||
}
|
||||
RELS.THEME = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";
|
||||
|
||||
/* Even though theme layout is dk1 lt1 dk2 lt2, true order is lt1 dk1 lt2 dk2 */
|
||||
var XLSXThemeClrScheme = [
|
||||
'</a:lt1>', '</a:dk1>', '</a:lt2>', '</a:dk2>',
|
||||
'</a:accent1>', '</a:accent2>', '</a:accent3>',
|
||||
'</a:accent4>', '</a:accent5>', '</a:accent6>',
|
||||
'</a:hlink>', '</a:folHlink>'
|
||||
];
|
||||
/* 20.1.6.2 clrScheme CT_ColorScheme */
|
||||
function parse_clrScheme(t, themes, opts) {
|
||||
themes.themeElements.clrScheme = [];
|
||||
@ -18768,7 +18804,7 @@ function parse_clrScheme(t, themes, opts) {
|
||||
case '<a:hlink>': case '</a:hlink>':
|
||||
case '<a:folHlink>': case '</a:folHlink>':
|
||||
if (y[0].charAt(1) === '/') {
|
||||
themes.themeElements.clrScheme.push(color);
|
||||
themes.themeElements.clrScheme[XLSXThemeClrScheme.indexOf(y[0])] = color;
|
||||
color = {};
|
||||
} else {
|
||||
color.name = y[0].slice(3, y[0].length - 1);
|
||||
@ -19507,7 +19543,7 @@ var rc_to_a1 = (function(){
|
||||
};
|
||||
})();
|
||||
|
||||
var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)([1-9]\d{0,5}|10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6])(?![_.\(A-Za-z0-9])/g;
|
||||
var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})(?![_.\(A-Za-z0-9])/g;
|
||||
var a1_to_rc =(function(){
|
||||
return function a1_to_rc(fstr, base) {
|
||||
return fstr.replace(crefregex, function($0, $1, $2, $3, $4, $5) {
|
||||
@ -22026,7 +22062,7 @@ var browser_has_Map = typeof Map !== 'undefined';
|
||||
function get_sst_id(sst, str, rev) {
|
||||
var i = 0, len = sst.length;
|
||||
if(rev) {
|
||||
if(browser_has_Map ? rev.has(str) : rev.hasOwnProperty(str)) {
|
||||
if(browser_has_Map ? rev.has(str) : Object.prototype.hasOwnProperty.call(rev, str)) {
|
||||
var revarr = browser_has_Map ? rev.get(str) : rev[str];
|
||||
for(; i < revarr.length; ++i) {
|
||||
if(sst[revarr[i]].t === str) { sst.Count ++; return revarr[i]; }
|
||||
@ -22041,7 +22077,7 @@ function get_sst_id(sst, str, rev) {
|
||||
if(!rev.has(str)) rev.set(str, []);
|
||||
rev.get(str).push(len);
|
||||
} else {
|
||||
if(!rev.hasOwnProperty(str)) rev[str] = [];
|
||||
if(!Object.prototype.hasOwnProperty.call(rev, str)) rev[str] = [];
|
||||
rev[str].push(len);
|
||||
}
|
||||
}
|
||||
@ -24165,7 +24201,7 @@ if(wb.Workbook.WBProps.CodeName) { workbookPr.codeName = wb.Workbook.WBProps.Cod
|
||||
if(n.Sheet != null) d.localSheetId = ""+n.Sheet;
|
||||
if(n.Hidden) d.hidden = "1";
|
||||
if(!n.Ref) return;
|
||||
o[o.length] = writextag('definedName', String(n.Ref).replace(/</g, "<").replace(/>/g, ">"), d);
|
||||
o[o.length] = writextag('definedName', escapexml(n.Ref), d);
|
||||
});
|
||||
o[o.length] = "</definedNames>";
|
||||
}
|
||||
@ -24681,7 +24717,10 @@ function parse_xlml_data(xml, ss, data, cell, base, styles, csty, row, arrayf, o
|
||||
if(!cell.t) cell.t = 'n';
|
||||
break;
|
||||
case 'Error': cell.t = 'e'; cell.v = RBErr[xml]; if(o.cellText !== false) cell.w = xml; break;
|
||||
default: cell.t = 's'; cell.v = xlml_fixstr(ss||xml); break;
|
||||
default:
|
||||
if(xml == "" && ss == "") { cell.t = 'z'; }
|
||||
else { cell.t = 's'; cell.v = xlml_fixstr(ss||xml); }
|
||||
break;
|
||||
}
|
||||
safe_format_xlml(cell, nf, o);
|
||||
if(o.cellFormula !== false) {
|
||||
@ -25469,7 +25508,9 @@ function write_sty_xlml(wb, opts) {
|
||||
opts.cellXfs.forEach(function(xf, id) {
|
||||
var payload = [];
|
||||
payload.push(writextag('NumberFormat', null, {"ss:Format": escapexml(SSF._table[xf.numFmtId])}));
|
||||
styles.push(writextag('Style', payload.join(""), {"ss:ID": "s" + (21+id)}));
|
||||
|
||||
var o = {"ss:ID": "s" + (21+id)};
|
||||
styles.push(writextag('Style', payload.join(""), o));
|
||||
});
|
||||
return writextag("Styles", styles.join(""));
|
||||
}
|
||||
@ -26639,12 +26680,12 @@ function write_xls_props(wb, cfb) {
|
||||
if(wb.Props) {
|
||||
Keys = keys(wb.Props);
|
||||
// $FlowIgnore
|
||||
for(i = 0; i < Keys.length; ++i) (DocSummaryRE.hasOwnProperty(Keys[i]) ? DSEntries : SummaryRE.hasOwnProperty(Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Props[Keys[i]]]);
|
||||
for(i = 0; i < Keys.length; ++i) (Object.prototype.hasOwnProperty.call(DocSummaryRE, Keys[i]) ? DSEntries : Object.prototype.hasOwnProperty.call(SummaryRE, Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Props[Keys[i]]]);
|
||||
}
|
||||
if(wb.Custprops) {
|
||||
Keys = keys(wb.Custprops);
|
||||
// $FlowIgnore
|
||||
for(i = 0; i < Keys.length; ++i) if(!(wb.Props||{}).hasOwnProperty(Keys[i])) (DocSummaryRE.hasOwnProperty(Keys[i]) ? DSEntries : SummaryRE.hasOwnProperty(Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Custprops[Keys[i]]]);
|
||||
for(i = 0; i < Keys.length; ++i) if(!Object.prototype.hasOwnProperty.call((wb.Props||{}), Keys[i])) (Object.prototype.hasOwnProperty.call(DocSummaryRE, Keys[i]) ? DSEntries : Object.prototype.hasOwnProperty.call(SummaryRE, Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Custprops[Keys[i]]]);
|
||||
}
|
||||
var CEntries2 = [];
|
||||
for(i = 0; i < CEntries.length; ++i) {
|
||||
@ -27999,6 +28040,29 @@ function write_biff_rec(ba, type, payload, length) {
|
||||
if(len > 0 && is_buf(payload)) ba.push(payload);
|
||||
}
|
||||
|
||||
//function write_biff_continue(ba, type, payload, length) {
|
||||
// var len = length || (payload||[]).length || 0;
|
||||
// if(len <= 8224) return write_biff_rec(ba, type, payload, len);
|
||||
// var t = +type || +XLSRE[type];
|
||||
// if(isNaN(t)) return;
|
||||
// var parts = payload.parts || [], sidx = 0;
|
||||
// var i = 0, w = 0;
|
||||
// while(w + (parts[sidx] || 8224) <= 8224) { w+= (parts[sidx] || 8224); sidx++; }
|
||||
// var o = ba.next(4);
|
||||
// o.write_shift(2, t);
|
||||
// o.write_shift(2, w);
|
||||
// ba.push(payload.slice(i, i + w));
|
||||
// i += w;
|
||||
// while(i < len) {
|
||||
// o = ba.next(4);
|
||||
// o.write_shift(2, 0x3c); // TODO: figure out correct continue type
|
||||
// w = 0;
|
||||
// while(w + (parts[sidx] || 8224) <= 8224) { w+= (parts[sidx] || 8224); sidx++; }
|
||||
// o.write_shift(2, w);
|
||||
// ba.push(payload.slice(i, i+w)); i+= w;
|
||||
// }
|
||||
//}
|
||||
|
||||
function write_BIFF2Cell(out, r, c) {
|
||||
if(!out) out = new_buf(7);
|
||||
out.write_shift(2, r);
|
||||
@ -28724,6 +28788,7 @@ var parse_content_xml = (function() {
|
||||
if(atag.Target) q.l = atag;
|
||||
if(comments.length > 0) { q.c = comments; comments = []; }
|
||||
if(textp && opts.cellText !== false) q.w = textp;
|
||||
if(isstub) { q.t = "z"; delete q.v; }
|
||||
if(!isstub || opts.sheetStubs) {
|
||||
if(!(opts.sheetRows && opts.sheetRows <= R)) {
|
||||
for(var rpt = 0; rpt < rowpeat; ++rpt) {
|
||||
@ -29215,6 +29280,11 @@ var write_content_ods = (function() {
|
||||
o.push(' <number:text>/</number:text>\n');
|
||||
o.push(' <number:year/>\n');
|
||||
o.push(' </number:date-style>\n');
|
||||
|
||||
o.push(' <style:style style:name="ta1" style:family="table">\n'); // style:master-page-name="mp1">\n');
|
||||
o.push(' <style:table-properties table:display="true" style:writing-mode="lr-tb"/>\n');
|
||||
o.push(' </style:style>\n');
|
||||
|
||||
o.push(' <style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>\n');
|
||||
o.push(' </office:automatic-styles>\n');
|
||||
};
|
||||
@ -29838,7 +29908,7 @@ function readSync(data, opts) {
|
||||
if(typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) return readSync(new Uint8Array(data), opts);
|
||||
var d = data, n = [0,0,0,0], str = false;
|
||||
var o = opts||{};
|
||||
if(o.cellStyles) { o.cellNF = true; }
|
||||
if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; }
|
||||
_ssfopts = {};
|
||||
if(o.dateNF) _ssfopts.dateNF = o.dateNF;
|
||||
if(!o.type) o.type = (has_buf && Buffer.isBuffer(data)) ? "buffer" : "base64";
|
||||
@ -29883,7 +29953,6 @@ function write_cfb_ctr(cfb, o) {
|
||||
return CFB.write(cfb, o);
|
||||
}
|
||||
|
||||
/*global encrypt_agile */
|
||||
function write_zip_type(wb, opts) {
|
||||
var o = opts||{};
|
||||
var z = write_zip(wb, o);
|
||||
@ -29899,7 +29968,9 @@ function write_zip_type(wb, opts) {
|
||||
default: throw new Error("Unrecognized type " + o.type);
|
||||
}
|
||||
var out = z.FullPaths ? CFB.write(z, {fileType:"zip", type: {"nodebuffer": "buffer", "string": "binary"}[oopts.type] || oopts.type}) : z.generate(oopts);
|
||||
if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.password), o);
|
||||
/*jshint -W083 */
|
||||
if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.password), o); // eslint-disable-line no-undef
|
||||
/*jshint +W083 */
|
||||
if(o.type === "file") return write_dl(o.file, out);
|
||||
return o.type == "string" ? utf8read(out) : out;
|
||||
}
|
||||
@ -29960,7 +30031,7 @@ function writeSync(wb, opts) {
|
||||
reset_cp();
|
||||
check_wb(wb);
|
||||
var o = opts||{};
|
||||
if(o.cellStyles) { o.cellNF = true; }
|
||||
if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; }
|
||||
if(o.type == "array") { o.type = "binary"; var out = (writeSync(wb, o)); o.type = "array"; return s2ab(out); }
|
||||
switch(o.bookType || 'xlsb') {
|
||||
case 'xml':
|
||||
@ -30024,7 +30095,7 @@ function writeFileAsync(filename, wb, opts, cb) {
|
||||
}
|
||||
function make_json_row(sheet, r, R, cols, header, hdr, dense, o) {
|
||||
var rr = encode_row(R);
|
||||
var defval = o.defval, raw = o.raw || !o.hasOwnProperty("raw");
|
||||
var defval = o.defval, raw = o.raw || !Object.prototype.hasOwnProperty.call(o, "raw");
|
||||
var isempty = true;
|
||||
var row = (header === 1) ? [] : {};
|
||||
if(header !== 1) {
|
||||
|
32
dist/xlsx.full.min.js
generated
vendored
32
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
141
dist/xlsx.js
generated
vendored
141
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.15.5';
|
||||
XLSX.version = '0.15.6';
|
||||
var current_codepage = 1200, current_ansi = 1252;
|
||||
/*global cptable:true, window */
|
||||
if(typeof module !== "undefined" && typeof require !== 'undefined') {
|
||||
@ -192,7 +192,7 @@ var chr0 = /\u0000/g, chr1 = /[\u0001-\u0006]/g;
|
||||
/*jshint -W041 */
|
||||
var SSF = ({});
|
||||
var make_ssf = function make_ssf(SSF){
|
||||
SSF.version = '0.10.2';
|
||||
SSF.version = '0.10.3';
|
||||
function _strrev(x) { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; }
|
||||
function fill(c,l) { var o = ""; while(o.length < l) o+=c; return o; }
|
||||
function pad0(v,d){var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;}
|
||||
@ -356,7 +356,7 @@ function general_fmt(v, opts) {
|
||||
switch(typeof v) {
|
||||
case 'string': return v;
|
||||
case 'boolean': return v ? "TRUE" : "FALSE";
|
||||
case 'number': return (v|0) === v ? general_fmt_int(v) : general_fmt_num(v);
|
||||
case 'number': return (v|0) === v ? v.toString(10) : general_fmt_num(v);
|
||||
case 'undefined': return "";
|
||||
case 'object':
|
||||
if(v == null) return "";
|
||||
@ -736,7 +736,7 @@ function fmt_is_date(fmt) {
|
||||
while(i < fmt.length) {
|
||||
switch((c = fmt.charAt(i))) {
|
||||
case 'G': if(isgeneral(fmt, i)) i+= 6; i++; break;
|
||||
case '"': for(;(/*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;) ++i; ++i; break;
|
||||
case '"': for(;(/*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;){/*empty*/} ++i; break;
|
||||
case '\\': i+=2; break;
|
||||
case '_': i+=2; break;
|
||||
case '@': ++i; break;
|
||||
@ -845,6 +845,7 @@ function eval_fmt(fmt, v, opts, flen) {
|
||||
o = c; while(i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1) o+=fmt.charAt(i);
|
||||
out[out.length] = {t:'D', v:o}; break;
|
||||
case ' ': out[out.length] = {t:c, v:c}; ++i; break;
|
||||
case "$": out[out.length] = {t:'t', v:'$'}; ++i; break;
|
||||
default:
|
||||
if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized character ' + c + ' in ' + fmt);
|
||||
out[out.length] = {t:'t', v:c}; ++i; break;
|
||||
@ -1143,7 +1144,7 @@ var DO_NOT_EXPORT_CFB = true;
|
||||
/* vim: set ts=2: */
|
||||
/*jshint eqnull:true */
|
||||
/*exported CFB */
|
||||
/*global module, require:false, process:false, Buffer:false, Uint8Array:false, Uint16Array:false */
|
||||
/*global Uint8Array:false, Uint16Array:false */
|
||||
|
||||
/* crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
@ -1249,7 +1250,7 @@ CRC32.str = crc32_str;
|
||||
/* [MS-CFB] v20171201 */
|
||||
var CFB = (function _CFB(){
|
||||
var exports = {};
|
||||
exports.version = '1.1.3';
|
||||
exports.version = '1.1.4';
|
||||
/* [MS-CFB] 2.6.4 */
|
||||
function namecmp(l, r) {
|
||||
var L = l.split("/"), R = r.split("/");
|
||||
@ -1580,7 +1581,9 @@ function make_sector_list(sectors, dir_start, fat_addrs, ssz) {
|
||||
k = (i + dir_start); if(k >= sl) k-=sl;
|
||||
if(chkd[k]) continue;
|
||||
buf_chain = [];
|
||||
var seen = [];
|
||||
for(j=k; j>=0;) {
|
||||
seen[j] = true;
|
||||
chkd[j] = true;
|
||||
buf[buf.length] = j;
|
||||
buf_chain.push(sectors[j]);
|
||||
@ -1589,6 +1592,7 @@ function make_sector_list(sectors, dir_start, fat_addrs, ssz) {
|
||||
if(ssz < 4 + jj) throw new Error("FAT boundary crossed: " + j + " 4 "+ssz);
|
||||
if(!sectors[addr]) break;
|
||||
j = __readInt32LE(sectors[addr], jj);
|
||||
if(seen[j]) break;
|
||||
}
|
||||
sector_list[k] = ({nodes: buf, data:__toBuffer([buf_chain])});
|
||||
}
|
||||
@ -2589,7 +2593,7 @@ function blobify(data) {
|
||||
}
|
||||
/* write or download file */
|
||||
function write_dl(fname, payload, enc) {
|
||||
/*global IE_SaveFile, Blob, navigator, saveAs, URL, document, File, chrome */
|
||||
/*global IE_SaveFile, Blob, navigator, saveAs, document, File, chrome */
|
||||
if(typeof _fs !== 'undefined' && _fs.writeFileSync) return enc ? _fs.writeFileSync(fname, payload, enc) : _fs.writeFileSync(fname, payload);
|
||||
var data = (enc == "utf8") ? utf8write(payload) : payload;
|
||||
if(typeof IE_SaveFile !== 'undefined') return IE_SaveFile(data, fname);
|
||||
@ -2636,7 +2640,7 @@ function read_binary(path) {
|
||||
}
|
||||
function keys(o) {
|
||||
var ks = Object.keys(o), o2 = [];
|
||||
for(var i = 0; i < ks.length; ++i) if(o.hasOwnProperty(ks[i])) o2.push(ks[i]);
|
||||
for(var i = 0; i < ks.length; ++i) if(Object.prototype.hasOwnProperty.call(o, ks[i])) o2.push(ks[i]);
|
||||
return o2;
|
||||
}
|
||||
|
||||
@ -2741,7 +2745,7 @@ function dup(o) {
|
||||
if(typeof o != 'object' || o == null) return o;
|
||||
if(o instanceof Date) return new Date(o.getTime());
|
||||
var out = {};
|
||||
for(var k in o) if(o.hasOwnProperty(k)) out[k] = dup(o[k]);
|
||||
for(var k in o) if(Object.prototype.hasOwnProperty.call(o, k)) out[k] = dup(o[k]);
|
||||
return out;
|
||||
}
|
||||
|
||||
@ -2935,7 +2939,7 @@ var rencoding = evert(encodings);
|
||||
// TODO: CP remap (need to read file version to determine OS)
|
||||
var unescapexml = (function() {
|
||||
/* 22.4.2.4 bstr (Basic String) */
|
||||
var encregex = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/g, coderegex = /_x([\da-fA-F]{4})_/g;
|
||||
var encregex = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/ig, coderegex = /_x([\da-fA-F]{4})_/ig;
|
||||
return function unescapexml(text) {
|
||||
var s = text + '', i = s.indexOf("<![CDATA[");
|
||||
if(i == -1) return s.replace(encregex, function($$, $1) { return encodings[$$]||String.fromCharCode(parseInt($1,$$.indexOf("x")>-1?16:10))||$$; }).replace(coderegex,function(m,c) {return String.fromCharCode(parseInt(c,16));});
|
||||
@ -3062,7 +3066,7 @@ var htmldecode = (function() {
|
||||
var entities = [
|
||||
['nbsp', ' '], ['middot', '·'],
|
||||
['quot', '"'], ['apos', "'"], ['gt', '>'], ['lt', '<'], ['amp', '&']
|
||||
].map(function(x) { return [new RegExp('&' + x[0] + ';', "g"), x[1]]; });
|
||||
].map(function(x) { return [new RegExp('&' + x[0] + ';', "ig"), x[1]]; });
|
||||
return function htmldecode(str) {
|
||||
var o = str
|
||||
// Remove new lines and spaces from start of content
|
||||
@ -3497,7 +3501,7 @@ function encode_range_xls(r, opts) {
|
||||
}
|
||||
}
|
||||
if(r.s.c == 0 && !r.s.cRel) {
|
||||
if(r.e.c == (opts.biff >= 12 ? 0xFFFF : 0xFF) && !r.e.cRel) {
|
||||
if(r.e.c == (opts.biff >= 12 ? 0x3FFF : 0xFF) && !r.e.cRel) {
|
||||
return (r.s.rRel ? "" : "$") + encode_row(r.s.r) + ":" + (r.e.rRel ? "" : "$") + encode_row(r.e.r);
|
||||
}
|
||||
}
|
||||
@ -3695,6 +3699,12 @@ function write_XLWideString(data, o) {
|
||||
return _null ? o.slice(0, o.l) : o;
|
||||
}
|
||||
|
||||
/* [MS-XLSB] 2.5.91 */
|
||||
//function parse_LPWideString(data) {
|
||||
// var cchCharacters = data.read_shift(2);
|
||||
// return cchCharacters === 0 ? "" : data.read_shift(cchCharacters, "utf16le");
|
||||
//}
|
||||
|
||||
/* [MS-XLSB] 2.5.143 */
|
||||
function parse_StrRun(data) {
|
||||
return { ich: data.read_shift(2), ifnt: data.read_shift(2) };
|
||||
@ -3828,6 +3838,25 @@ function write_RfX(r, o) {
|
||||
var parse_UncheckedRfX = parse_RfX;
|
||||
var write_UncheckedRfX = write_RfX;
|
||||
|
||||
/* [MS-XLSB] 2.5.155 UncheckedSqRfX */
|
||||
//function parse_UncheckedSqRfX(data) {
|
||||
// var cnt = data.read_shift(4);
|
||||
// var out = [];
|
||||
// for(var i = 0; i < cnt; ++i) {
|
||||
// var rng = parse_UncheckedRfX(data);
|
||||
// out.push(encode_range(rng));
|
||||
// }
|
||||
// return out.join(",");
|
||||
//}
|
||||
//function write_UncheckedSqRfX(sqrfx) {
|
||||
// var parts = sqrfx.split(/\s*,\s*/);
|
||||
// var o = new_buf(4); o.write_shift(4, parts.length);
|
||||
// var out = [o];
|
||||
// parts.forEach(function(rng) {
|
||||
// out.push(write_UncheckedRfX(safe_decode_range(rng)));
|
||||
// });
|
||||
// return bconcat(out);
|
||||
//}
|
||||
|
||||
/* [MS-XLS] 2.5.342 ; [MS-XLSB] 2.5.171 */
|
||||
/* TODO: error checking, NaN and Infinity values are not valid Xnum */
|
||||
@ -4062,7 +4091,7 @@ var SpecialProperties = {
|
||||
};
|
||||
|
||||
(function() {
|
||||
for(var y in SpecialProperties) if(SpecialProperties.hasOwnProperty(y))
|
||||
for(var y in SpecialProperties) if(Object.prototype.hasOwnProperty.call(SpecialProperties, y))
|
||||
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
|
||||
})();
|
||||
|
||||
@ -5017,7 +5046,7 @@ function xlml_write_custprops(Props, Custprops) {
|
||||
var T = 'CustomDocumentProperties';
|
||||
var o = [];
|
||||
if(Props) keys(Props).forEach(function(k) {
|
||||
if(!Props.hasOwnProperty(k)) return;
|
||||
if(!Object.prototype.hasOwnProperty.call(Props, k)) return;
|
||||
for(var i = 0; i < CORE_PROPS.length; ++i) if(k == CORE_PROPS[i][1]) return;
|
||||
for(i = 0; i < EXT_PROPS.length; ++i) if(k == EXT_PROPS[i][1]) return;
|
||||
for(i = 0; i < BLACKLIST.length; ++i) if(k == BLACKLIST[i]) return;
|
||||
@ -5030,8 +5059,8 @@ if(!Props.hasOwnProperty(k)) return;
|
||||
o.push(writextag(escapexmltag(k), m, {"dt:dt":t}));
|
||||
});
|
||||
if(Custprops) keys(Custprops).forEach(function(k) {
|
||||
if(!Custprops.hasOwnProperty(k)) return;
|
||||
if(Props && Props.hasOwnProperty(k)) return;
|
||||
if(!Object.prototype.hasOwnProperty.call(Custprops, k)) return;
|
||||
if(Props && Object.prototype.hasOwnProperty.call(Props, k)) return;
|
||||
var m = Custprops[k];
|
||||
var t = "string";
|
||||
if(typeof m == 'number') { t = "float"; m = String(m); }
|
||||
@ -5996,7 +6025,7 @@ function write_Window1() {
|
||||
}
|
||||
/* [MS-XLS] 2.4.346 TODO */
|
||||
function parse_Window2(blob, length, opts) {
|
||||
if(opts && opts.biff >= 2 && opts.biff < 8) return {};
|
||||
if(opts && opts.biff >= 2 && opts.biff < 5) return {};
|
||||
var f = blob.read_shift(2);
|
||||
return { RTL: f & 0x40 };
|
||||
}
|
||||
@ -7498,13 +7527,13 @@ var PRN = (function() {
|
||||
}
|
||||
|
||||
cc = [];
|
||||
for(end in cnt) if ( cnt.hasOwnProperty(end) ) {
|
||||
for(end in cnt) if ( Object.prototype.hasOwnProperty.call(cnt, end) ) {
|
||||
cc.push([ cnt[end], end ]);
|
||||
}
|
||||
|
||||
if ( !cc.length ) {
|
||||
cnt = guess_sep_weights;
|
||||
for(end in cnt) if ( cnt.hasOwnProperty(end) ) {
|
||||
for(end in cnt) if ( Object.prototype.hasOwnProperty.call(cnt, end) ) {
|
||||
cc.push([ cnt[end], end ]);
|
||||
}
|
||||
}
|
||||
@ -8902,7 +8931,7 @@ function parse_fonts(t, styles, themes, opts) {
|
||||
break;
|
||||
|
||||
/* 18.8.29 name CT_FontName */
|
||||
case '<name': if(y.val) font.name = y.val; break;
|
||||
case '<name': if(y.val) font.name = utf8read(y.val); break;
|
||||
case '<name/>': case '</name>': break;
|
||||
|
||||
/* 18.8.2 b CT_BooleanProperty */
|
||||
@ -9141,11 +9170,11 @@ return function parse_sty_xml(data, themes, opts) {
|
||||
if((t=data.match(bordersRegex))) parse_borders(t, styles, themes, opts);
|
||||
|
||||
/* 18.8.9 cellStyleXfs CT_CellStyleXfs ? */
|
||||
/* 18.8.8 cellStyles CT_CellStyles ? */
|
||||
|
||||
/* 18.8.10 cellXfs CT_CellXfs ? */
|
||||
if((t=data.match(cellXfRegex))) parse_cellXfs(t, styles, opts);
|
||||
|
||||
/* 18.8.8 cellStyles CT_CellStyles ? */
|
||||
/* 18.8.15 dxfs CT_Dxfs ? */
|
||||
/* 18.8.42 tableStyles CT_TableStyles ? */
|
||||
/* 18.8.11 colors CT_Colors ? */
|
||||
@ -9569,6 +9598,13 @@ function write_sty_bin(wb, opts) {
|
||||
}
|
||||
RELS.THEME = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";
|
||||
|
||||
/* Even though theme layout is dk1 lt1 dk2 lt2, true order is lt1 dk1 lt2 dk2 */
|
||||
var XLSXThemeClrScheme = [
|
||||
'</a:lt1>', '</a:dk1>', '</a:lt2>', '</a:dk2>',
|
||||
'</a:accent1>', '</a:accent2>', '</a:accent3>',
|
||||
'</a:accent4>', '</a:accent5>', '</a:accent6>',
|
||||
'</a:hlink>', '</a:folHlink>'
|
||||
];
|
||||
/* 20.1.6.2 clrScheme CT_ColorScheme */
|
||||
function parse_clrScheme(t, themes, opts) {
|
||||
themes.themeElements.clrScheme = [];
|
||||
@ -9612,7 +9648,7 @@ function parse_clrScheme(t, themes, opts) {
|
||||
case '<a:hlink>': case '</a:hlink>':
|
||||
case '<a:folHlink>': case '</a:folHlink>':
|
||||
if (y[0].charAt(1) === '/') {
|
||||
themes.themeElements.clrScheme.push(color);
|
||||
themes.themeElements.clrScheme[XLSXThemeClrScheme.indexOf(y[0])] = color;
|
||||
color = {};
|
||||
} else {
|
||||
color.name = y[0].slice(3, y[0].length - 1);
|
||||
@ -10351,7 +10387,7 @@ var rc_to_a1 = (function(){
|
||||
};
|
||||
})();
|
||||
|
||||
var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)([1-9]\d{0,5}|10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6])(?![_.\(A-Za-z0-9])/g;
|
||||
var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})(?![_.\(A-Za-z0-9])/g;
|
||||
var a1_to_rc =(function(){
|
||||
return function a1_to_rc(fstr, base) {
|
||||
return fstr.replace(crefregex, function($0, $1, $2, $3, $4, $5) {
|
||||
@ -12870,7 +12906,7 @@ var browser_has_Map = typeof Map !== 'undefined';
|
||||
function get_sst_id(sst, str, rev) {
|
||||
var i = 0, len = sst.length;
|
||||
if(rev) {
|
||||
if(browser_has_Map ? rev.has(str) : rev.hasOwnProperty(str)) {
|
||||
if(browser_has_Map ? rev.has(str) : Object.prototype.hasOwnProperty.call(rev, str)) {
|
||||
var revarr = browser_has_Map ? rev.get(str) : rev[str];
|
||||
for(; i < revarr.length; ++i) {
|
||||
if(sst[revarr[i]].t === str) { sst.Count ++; return revarr[i]; }
|
||||
@ -12885,7 +12921,7 @@ function get_sst_id(sst, str, rev) {
|
||||
if(!rev.has(str)) rev.set(str, []);
|
||||
rev.get(str).push(len);
|
||||
} else {
|
||||
if(!rev.hasOwnProperty(str)) rev[str] = [];
|
||||
if(!Object.prototype.hasOwnProperty.call(rev, str)) rev[str] = [];
|
||||
rev[str].push(len);
|
||||
}
|
||||
}
|
||||
@ -15009,7 +15045,7 @@ if(wb.Workbook.WBProps.CodeName) { workbookPr.codeName = wb.Workbook.WBProps.Cod
|
||||
if(n.Sheet != null) d.localSheetId = ""+n.Sheet;
|
||||
if(n.Hidden) d.hidden = "1";
|
||||
if(!n.Ref) return;
|
||||
o[o.length] = writextag('definedName', String(n.Ref).replace(/</g, "<").replace(/>/g, ">"), d);
|
||||
o[o.length] = writextag('definedName', escapexml(n.Ref), d);
|
||||
});
|
||||
o[o.length] = "</definedNames>";
|
||||
}
|
||||
@ -15525,7 +15561,10 @@ function parse_xlml_data(xml, ss, data, cell, base, styles, csty, row, arrayf, o
|
||||
if(!cell.t) cell.t = 'n';
|
||||
break;
|
||||
case 'Error': cell.t = 'e'; cell.v = RBErr[xml]; if(o.cellText !== false) cell.w = xml; break;
|
||||
default: cell.t = 's'; cell.v = xlml_fixstr(ss||xml); break;
|
||||
default:
|
||||
if(xml == "" && ss == "") { cell.t = 'z'; }
|
||||
else { cell.t = 's'; cell.v = xlml_fixstr(ss||xml); }
|
||||
break;
|
||||
}
|
||||
safe_format_xlml(cell, nf, o);
|
||||
if(o.cellFormula !== false) {
|
||||
@ -16313,7 +16352,9 @@ function write_sty_xlml(wb, opts) {
|
||||
opts.cellXfs.forEach(function(xf, id) {
|
||||
var payload = [];
|
||||
payload.push(writextag('NumberFormat', null, {"ss:Format": escapexml(SSF._table[xf.numFmtId])}));
|
||||
styles.push(writextag('Style', payload.join(""), {"ss:ID": "s" + (21+id)}));
|
||||
|
||||
var o = {"ss:ID": "s" + (21+id)};
|
||||
styles.push(writextag('Style', payload.join(""), o));
|
||||
});
|
||||
return writextag("Styles", styles.join(""));
|
||||
}
|
||||
@ -17483,12 +17524,12 @@ function write_xls_props(wb, cfb) {
|
||||
if(wb.Props) {
|
||||
Keys = keys(wb.Props);
|
||||
// $FlowIgnore
|
||||
for(i = 0; i < Keys.length; ++i) (DocSummaryRE.hasOwnProperty(Keys[i]) ? DSEntries : SummaryRE.hasOwnProperty(Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Props[Keys[i]]]);
|
||||
for(i = 0; i < Keys.length; ++i) (Object.prototype.hasOwnProperty.call(DocSummaryRE, Keys[i]) ? DSEntries : Object.prototype.hasOwnProperty.call(SummaryRE, Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Props[Keys[i]]]);
|
||||
}
|
||||
if(wb.Custprops) {
|
||||
Keys = keys(wb.Custprops);
|
||||
// $FlowIgnore
|
||||
for(i = 0; i < Keys.length; ++i) if(!(wb.Props||{}).hasOwnProperty(Keys[i])) (DocSummaryRE.hasOwnProperty(Keys[i]) ? DSEntries : SummaryRE.hasOwnProperty(Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Custprops[Keys[i]]]);
|
||||
for(i = 0; i < Keys.length; ++i) if(!Object.prototype.hasOwnProperty.call((wb.Props||{}), Keys[i])) (Object.prototype.hasOwnProperty.call(DocSummaryRE, Keys[i]) ? DSEntries : Object.prototype.hasOwnProperty.call(SummaryRE, Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Custprops[Keys[i]]]);
|
||||
}
|
||||
var CEntries2 = [];
|
||||
for(i = 0; i < CEntries.length; ++i) {
|
||||
@ -18843,6 +18884,29 @@ function write_biff_rec(ba, type, payload, length) {
|
||||
if(len > 0 && is_buf(payload)) ba.push(payload);
|
||||
}
|
||||
|
||||
//function write_biff_continue(ba, type, payload, length) {
|
||||
// var len = length || (payload||[]).length || 0;
|
||||
// if(len <= 8224) return write_biff_rec(ba, type, payload, len);
|
||||
// var t = +type || +XLSRE[type];
|
||||
// if(isNaN(t)) return;
|
||||
// var parts = payload.parts || [], sidx = 0;
|
||||
// var i = 0, w = 0;
|
||||
// while(w + (parts[sidx] || 8224) <= 8224) { w+= (parts[sidx] || 8224); sidx++; }
|
||||
// var o = ba.next(4);
|
||||
// o.write_shift(2, t);
|
||||
// o.write_shift(2, w);
|
||||
// ba.push(payload.slice(i, i + w));
|
||||
// i += w;
|
||||
// while(i < len) {
|
||||
// o = ba.next(4);
|
||||
// o.write_shift(2, 0x3c); // TODO: figure out correct continue type
|
||||
// w = 0;
|
||||
// while(w + (parts[sidx] || 8224) <= 8224) { w+= (parts[sidx] || 8224); sidx++; }
|
||||
// o.write_shift(2, w);
|
||||
// ba.push(payload.slice(i, i+w)); i+= w;
|
||||
// }
|
||||
//}
|
||||
|
||||
function write_BIFF2Cell(out, r, c) {
|
||||
if(!out) out = new_buf(7);
|
||||
out.write_shift(2, r);
|
||||
@ -19568,6 +19632,7 @@ var parse_content_xml = (function() {
|
||||
if(atag.Target) q.l = atag;
|
||||
if(comments.length > 0) { q.c = comments; comments = []; }
|
||||
if(textp && opts.cellText !== false) q.w = textp;
|
||||
if(isstub) { q.t = "z"; delete q.v; }
|
||||
if(!isstub || opts.sheetStubs) {
|
||||
if(!(opts.sheetRows && opts.sheetRows <= R)) {
|
||||
for(var rpt = 0; rpt < rowpeat; ++rpt) {
|
||||
@ -20059,6 +20124,11 @@ var write_content_ods = (function() {
|
||||
o.push(' <number:text>/</number:text>\n');
|
||||
o.push(' <number:year/>\n');
|
||||
o.push(' </number:date-style>\n');
|
||||
|
||||
o.push(' <style:style style:name="ta1" style:family="table">\n'); // style:master-page-name="mp1">\n');
|
||||
o.push(' <style:table-properties table:display="true" style:writing-mode="lr-tb"/>\n');
|
||||
o.push(' </style:style>\n');
|
||||
|
||||
o.push(' <style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>\n');
|
||||
o.push(' </office:automatic-styles>\n');
|
||||
};
|
||||
@ -20682,7 +20752,7 @@ function readSync(data, opts) {
|
||||
if(typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) return readSync(new Uint8Array(data), opts);
|
||||
var d = data, n = [0,0,0,0], str = false;
|
||||
var o = opts||{};
|
||||
if(o.cellStyles) { o.cellNF = true; }
|
||||
if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; }
|
||||
_ssfopts = {};
|
||||
if(o.dateNF) _ssfopts.dateNF = o.dateNF;
|
||||
if(!o.type) o.type = (has_buf && Buffer.isBuffer(data)) ? "buffer" : "base64";
|
||||
@ -20727,7 +20797,6 @@ function write_cfb_ctr(cfb, o) {
|
||||
return CFB.write(cfb, o);
|
||||
}
|
||||
|
||||
/*global encrypt_agile */
|
||||
function write_zip_type(wb, opts) {
|
||||
var o = opts||{};
|
||||
var z = write_zip(wb, o);
|
||||
@ -20743,7 +20812,9 @@ function write_zip_type(wb, opts) {
|
||||
default: throw new Error("Unrecognized type " + o.type);
|
||||
}
|
||||
var out = z.FullPaths ? CFB.write(z, {fileType:"zip", type: {"nodebuffer": "buffer", "string": "binary"}[oopts.type] || oopts.type}) : z.generate(oopts);
|
||||
if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.password), o);
|
||||
/*jshint -W083 */
|
||||
if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.password), o); // eslint-disable-line no-undef
|
||||
/*jshint +W083 */
|
||||
if(o.type === "file") return write_dl(o.file, out);
|
||||
return o.type == "string" ? utf8read(out) : out;
|
||||
}
|
||||
@ -20804,7 +20875,7 @@ function writeSync(wb, opts) {
|
||||
reset_cp();
|
||||
check_wb(wb);
|
||||
var o = opts||{};
|
||||
if(o.cellStyles) { o.cellNF = true; }
|
||||
if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; }
|
||||
if(o.type == "array") { o.type = "binary"; var out = (writeSync(wb, o)); o.type = "array"; return s2ab(out); }
|
||||
switch(o.bookType || 'xlsb') {
|
||||
case 'xml':
|
||||
@ -20868,7 +20939,7 @@ function writeFileAsync(filename, wb, opts, cb) {
|
||||
}
|
||||
function make_json_row(sheet, r, R, cols, header, hdr, dense, o) {
|
||||
var rr = encode_row(R);
|
||||
var defval = o.defval, raw = o.raw || !o.hasOwnProperty("raw");
|
||||
var defval = o.defval, raw = o.raw || !Object.prototype.hasOwnProperty.call(o, "raw");
|
||||
var isempty = true;
|
||||
var row = (header === 1) ? [] : {};
|
||||
if(header !== 1) {
|
||||
|
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
dist/xlsx.mini.min.js
generated
vendored
12
dist/xlsx.mini.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/xlsx.mini.min.map
generated
vendored
2
dist/xlsx.mini.min.map
generated
vendored
File diff suppressed because one or more lines are too long
@ -54,7 +54,7 @@ Use readAsBinaryString: (when available) <input type="checkbox" name="userabs" c
|
||||
<script>
|
||||
/*jshint browser:true */
|
||||
/* eslint-env browser */
|
||||
/*global Uint8Array, console */
|
||||
/*global Uint8Array */
|
||||
/*global XLSX */
|
||||
/* exported b64it, setfmt */
|
||||
/* eslint no-use-before-define:0 */
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xlsx",
|
||||
"version": "0.15.5",
|
||||
"version": "0.15.6",
|
||||
"author": "sheetjs",
|
||||
"description": "SheetJS Spreadsheet data parser and writer",
|
||||
"keywords": [
|
||||
@ -33,12 +33,13 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"adler-32": "~1.2.0",
|
||||
"cfb": "^1.1.3",
|
||||
"cfb": "^1.1.4",
|
||||
"codepage": "~1.14.0",
|
||||
"commander": "~2.17.1",
|
||||
"crc-32": "~1.2.0",
|
||||
"exit-on-epipe": "~1.0.1",
|
||||
"ssf": "~0.10.2"
|
||||
"wmf": "~1.0.1",
|
||||
"ssf": "~0.10.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sheetjs/uglify-js": "~2.7.3",
|
||||
@ -75,7 +76,7 @@
|
||||
"holes"
|
||||
]
|
||||
},
|
||||
"homepage": "http://sheetjs.com/opensource",
|
||||
"homepage": "https://sheetjs.com/",
|
||||
"bugs": {
|
||||
"url": "https://github.com/SheetJS/js-xlsx/issues"
|
||||
},
|
||||
|
12
test.js
12
test.js
@ -1282,14 +1282,14 @@ describe('parse features', function() {
|
||||
fgColor: { theme: 9, raw_rgb: 'F79646' },
|
||||
bgColor: { theme: 5, raw_rgb: 'C0504D' } },
|
||||
{ patternType: 'darkUp',
|
||||
fgColor: { theme: 3, raw_rgb: 'EEECE1' },
|
||||
fgColor: { theme: 3, raw_rgb: '1F497D' },
|
||||
bgColor: { theme: 7, raw_rgb: '8064A2' } },
|
||||
{ patternType: 'darkGray',
|
||||
fgColor: { theme: 3, raw_rgb: 'EEECE1' },
|
||||
bgColor: { theme: 1, raw_rgb: 'FFFFFF' } },
|
||||
fgColor: { theme: 3, raw_rgb: '1F497D' },
|
||||
bgColor: { theme: 1, raw_rgb: '000000' } },
|
||||
{ patternType: 'lightGray',
|
||||
fgColor: { theme: 6, raw_rgb: '9BBB59' },
|
||||
bgColor: { theme: 2, raw_rgb: '1F497D' } },
|
||||
bgColor: { theme: 2, raw_rgb: 'EEECE1' } },
|
||||
{ patternType: 'lightDown',
|
||||
fgColor: { theme: 4, raw_rgb: '4F81BD' },
|
||||
bgColor: { theme: 7, raw_rgb: '8064A2' } },
|
||||
@ -1298,9 +1298,9 @@ describe('parse features', function() {
|
||||
bgColor: { theme: 9, raw_rgb: 'F79646' } },
|
||||
{ patternType: 'lightGrid',
|
||||
fgColor: { theme: 4, raw_rgb: '4F81BD' },
|
||||
bgColor: { theme: 2, raw_rgb: '1F497D' } },
|
||||
bgColor: { theme: 2, raw_rgb: 'EEECE1' } },
|
||||
{ patternType: 'lightVertical',
|
||||
fgColor: { theme: 3, raw_rgb: 'EEECE1' },
|
||||
fgColor: { theme: 3, raw_rgb: '1F497D' },
|
||||
bgColor: { theme: 7, raw_rgb: '8064A2' } }
|
||||
];
|
||||
/*eslint-enable */
|
||||
|
20
tests/core.js
generated
20
tests/core.js
generated
@ -761,6 +761,13 @@ describe('API', function() {
|
||||
X.utils.sheet_add_aoa(ws, [[4,5,6,7,8,9,0]], {origin: -1});
|
||||
assert.equal(X.utils.sheet_to_csv(ws).trim(), "S,h,e,e,t,J,S\n1,2,,,5,6,7\n2,3,,,6,7,8\n3,4,,,7,8,9\n4,5,6,7,8,9,0");
|
||||
});
|
||||
it('sheet_add_aoa support object cell', function() {
|
||||
var data = X.utils.aoa_to_sheet([
|
||||
['url', 'name', 'id'],
|
||||
[ { l: { Target: 'https://123.com' }, v: 'url', t: 's' }, 'tom', 'xxx' ]
|
||||
]);
|
||||
if(assert.deepEqual) assert.deepEqual(data.A2, { l: { Target: 'https://123.com' }, v: 'url', t: 's' });
|
||||
});
|
||||
});
|
||||
|
||||
function coreprop(props) {
|
||||
@ -1275,14 +1282,14 @@ describe('parse features', function() {
|
||||
fgColor: { theme: 9, raw_rgb: 'F79646' },
|
||||
bgColor: { theme: 5, raw_rgb: 'C0504D' } },
|
||||
{ patternType: 'darkUp',
|
||||
fgColor: { theme: 3, raw_rgb: 'EEECE1' },
|
||||
fgColor: { theme: 3, raw_rgb: '1F497D' },
|
||||
bgColor: { theme: 7, raw_rgb: '8064A2' } },
|
||||
{ patternType: 'darkGray',
|
||||
fgColor: { theme: 3, raw_rgb: 'EEECE1' },
|
||||
bgColor: { theme: 1, raw_rgb: 'FFFFFF' } },
|
||||
fgColor: { theme: 3, raw_rgb: '1F497D' },
|
||||
bgColor: { theme: 1, raw_rgb: '000000' } },
|
||||
{ patternType: 'lightGray',
|
||||
fgColor: { theme: 6, raw_rgb: '9BBB59' },
|
||||
bgColor: { theme: 2, raw_rgb: '1F497D' } },
|
||||
bgColor: { theme: 2, raw_rgb: 'EEECE1' } },
|
||||
{ patternType: 'lightDown',
|
||||
fgColor: { theme: 4, raw_rgb: '4F81BD' },
|
||||
bgColor: { theme: 7, raw_rgb: '8064A2' } },
|
||||
@ -1291,9 +1298,9 @@ describe('parse features', function() {
|
||||
bgColor: { theme: 9, raw_rgb: 'F79646' } },
|
||||
{ patternType: 'lightGrid',
|
||||
fgColor: { theme: 4, raw_rgb: '4F81BD' },
|
||||
bgColor: { theme: 2, raw_rgb: '1F497D' } },
|
||||
bgColor: { theme: 2, raw_rgb: 'EEECE1' } },
|
||||
{ patternType: 'lightVertical',
|
||||
fgColor: { theme: 3, raw_rgb: 'EEECE1' },
|
||||
fgColor: { theme: 3, raw_rgb: '1F497D' },
|
||||
bgColor: { theme: 7, raw_rgb: '8064A2' } }
|
||||
];
|
||||
/*eslint-enable */
|
||||
@ -2373,4 +2380,3 @@ mft.forEach(function(x) {
|
||||
case "yes-formula": formulae = true; break;
|
||||
}});
|
||||
}); });
|
||||
|
||||
|
141
xlsx.flow.js
141
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.15.5';
|
||||
XLSX.version = '0.15.6';
|
||||
var current_codepage = 1200, current_ansi = 1252;
|
||||
/*:: declare var cptable:any; */
|
||||
/*global cptable:true, window */
|
||||
@ -213,7 +213,7 @@ type WriteObjStrFactory = {from_sheet(ws:Worksheet, o:any, wb:?Workbook):string}
|
||||
/*jshint -W041 */
|
||||
var SSF/*:SSFModule*/ = ({}/*:any*/);
|
||||
var make_ssf = function make_ssf(SSF/*:SSFModule*/){
|
||||
SSF.version = '0.10.2';
|
||||
SSF.version = '0.10.3';
|
||||
function _strrev(x/*:string*/)/*:string*/ { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; }
|
||||
function fill(c/*:string*/,l/*:number*/)/*:string*/ { var o = ""; while(o.length < l) o+=c; return o; }
|
||||
function pad0(v/*:any*/,d/*:number*/)/*:string*/{var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;}
|
||||
@ -380,7 +380,7 @@ function general_fmt(v/*:any*/, opts/*:any*/) {
|
||||
switch(typeof v) {
|
||||
case 'string': return v;
|
||||
case 'boolean': return v ? "TRUE" : "FALSE";
|
||||
case 'number': return (v|0) === v ? general_fmt_int(v) : general_fmt_num(v);
|
||||
case 'number': return (v|0) === v ? v.toString(10) : general_fmt_num(v);
|
||||
case 'undefined': return "";
|
||||
case 'object':
|
||||
if(v == null) return "";
|
||||
@ -763,7 +763,7 @@ function fmt_is_date(fmt/*:string*/)/*:boolean*/ {
|
||||
while(i < fmt.length) {
|
||||
switch((c = fmt.charAt(i))) {
|
||||
case 'G': if(isgeneral(fmt, i)) i+= 6; i++; break;
|
||||
case '"': for(;(/*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;) ++i; ++i; break;
|
||||
case '"': for(;(/*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;){/*empty*/} ++i; break;
|
||||
case '\\': i+=2; break;
|
||||
case '_': i+=2; break;
|
||||
case '@': ++i; break;
|
||||
@ -872,6 +872,7 @@ function eval_fmt(fmt/*:string*/, v/*:any*/, opts/*:any*/, flen/*:number*/) {
|
||||
o = c; while(i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1) o+=fmt.charAt(i);
|
||||
out[out.length] = {t:'D', v:o}; break;
|
||||
case ' ': out[out.length] = {t:c, v:c}; ++i; break;
|
||||
case "$": out[out.length] = {t:'t', v:'$'}; ++i; break;
|
||||
default:
|
||||
if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized character ' + c + ' in ' + fmt);
|
||||
out[out.length] = {t:'t', v:c}; ++i; break;
|
||||
@ -1195,7 +1196,7 @@ declare var new_unsafe_buf:any;
|
||||
/* vim: set ts=2: */
|
||||
/*jshint eqnull:true */
|
||||
/*exported CFB */
|
||||
/*global module, require:false, process:false, Buffer:false, Uint8Array:false, Uint16Array:false */
|
||||
/*global Uint8Array:false, Uint16Array:false */
|
||||
|
||||
/*::
|
||||
declare var DO_NOT_EXPORT_CFB:?boolean;
|
||||
@ -1316,7 +1317,7 @@ CRC32.str = crc32_str;
|
||||
/* [MS-CFB] v20171201 */
|
||||
var CFB = (function _CFB(){
|
||||
var exports/*:CFBModule*/ = /*::(*/{}/*:: :any)*/;
|
||||
exports.version = '1.1.3';
|
||||
exports.version = '1.1.4';
|
||||
/* [MS-CFB] 2.6.4 */
|
||||
function namecmp(l/*:string*/, r/*:string*/)/*:number*/ {
|
||||
var L = l.split("/"), R = r.split("/");
|
||||
@ -1647,7 +1648,9 @@ function make_sector_list(sectors/*:Array<RawBytes>*/, dir_start/*:number*/, fat
|
||||
k = (i + dir_start); if(k >= sl) k-=sl;
|
||||
if(chkd[k]) continue;
|
||||
buf_chain = [];
|
||||
var seen = [];
|
||||
for(j=k; j>=0;) {
|
||||
seen[j] = true;
|
||||
chkd[j] = true;
|
||||
buf[buf.length] = j;
|
||||
buf_chain.push(sectors[j]);
|
||||
@ -1656,6 +1659,7 @@ function make_sector_list(sectors/*:Array<RawBytes>*/, dir_start/*:number*/, fat
|
||||
if(ssz < 4 + jj) throw new Error("FAT boundary crossed: " + j + " 4 "+ssz);
|
||||
if(!sectors[addr]) break;
|
||||
j = __readInt32LE(sectors[addr], jj);
|
||||
if(seen[j]) break;
|
||||
}
|
||||
sector_list[k] = ({nodes: buf, data:__toBuffer([buf_chain])}/*:SectorEntry*/);
|
||||
}
|
||||
@ -2663,7 +2667,7 @@ function blobify(data) {
|
||||
}
|
||||
/* write or download file */
|
||||
function write_dl(fname/*:string*/, payload/*:any*/, enc/*:?string*/) {
|
||||
/*global IE_SaveFile, Blob, navigator, saveAs, URL, document, File, chrome */
|
||||
/*global IE_SaveFile, Blob, navigator, saveAs, document, File, chrome */
|
||||
if(typeof _fs !== 'undefined' && _fs.writeFileSync) return enc ? _fs.writeFileSync(fname, payload, enc) : _fs.writeFileSync(fname, payload);
|
||||
var data = (enc == "utf8") ? utf8write(payload) : payload;
|
||||
/*:: declare var IE_SaveFile: any; */
|
||||
@ -2715,7 +2719,7 @@ function read_binary(path/*:string*/) {
|
||||
}
|
||||
function keys(o/*:any*/)/*:Array<any>*/ {
|
||||
var ks = Object.keys(o), o2 = [];
|
||||
for(var i = 0; i < ks.length; ++i) if(o.hasOwnProperty(ks[i])) o2.push(ks[i]);
|
||||
for(var i = 0; i < ks.length; ++i) if(Object.prototype.hasOwnProperty.call(o, ks[i])) o2.push(ks[i]);
|
||||
return o2;
|
||||
}
|
||||
|
||||
@ -2821,7 +2825,7 @@ function dup(o/*:any*/)/*:any*/ {
|
||||
if(typeof o != 'object' || o == null) return o;
|
||||
if(o instanceof Date) return new Date(o.getTime());
|
||||
var out = {};
|
||||
for(var k in o) if(o.hasOwnProperty(k)) out[k] = dup(o[k]);
|
||||
for(var k in o) if(Object.prototype.hasOwnProperty.call(o, k)) out[k] = dup(o[k]);
|
||||
return out;
|
||||
}
|
||||
|
||||
@ -3016,7 +3020,7 @@ var rencoding = evert(encodings);
|
||||
// TODO: CP remap (need to read file version to determine OS)
|
||||
var unescapexml/*:StringConv*/ = (function() {
|
||||
/* 22.4.2.4 bstr (Basic String) */
|
||||
var encregex = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/g, coderegex = /_x([\da-fA-F]{4})_/g;
|
||||
var encregex = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/ig, coderegex = /_x([\da-fA-F]{4})_/ig;
|
||||
return function unescapexml(text/*:string*/)/*:string*/ {
|
||||
var s = text + '', i = s.indexOf("<![CDATA[");
|
||||
if(i == -1) return s.replace(encregex, function($$, $1) { return encodings[$$]||String.fromCharCode(parseInt($1,$$.indexOf("x")>-1?16:10))||$$; }).replace(coderegex,function(m,c) {return String.fromCharCode(parseInt(c,16));});
|
||||
@ -3143,7 +3147,7 @@ var htmldecode/*:{(s:string):string}*/ = (function() {
|
||||
var entities/*:Array<[RegExp, string]>*/ = [
|
||||
['nbsp', ' '], ['middot', '·'],
|
||||
['quot', '"'], ['apos', "'"], ['gt', '>'], ['lt', '<'], ['amp', '&']
|
||||
].map(function(x/*:[string, string]*/) { return [new RegExp('&' + x[0] + ';', "g"), x[1]]; });
|
||||
].map(function(x/*:[string, string]*/) { return [new RegExp('&' + x[0] + ';', "ig"), x[1]]; });
|
||||
return function htmldecode(str/*:string*/)/*:string*/ {
|
||||
var o = str
|
||||
// Remove new lines and spaces from start of content
|
||||
@ -3584,7 +3588,7 @@ function encode_range_xls(r, opts)/*:string*/ {
|
||||
}
|
||||
}
|
||||
if(r.s.c == 0 && !r.s.cRel) {
|
||||
if(r.e.c == (opts.biff >= 12 ? 0xFFFF : 0xFF) && !r.e.cRel) {
|
||||
if(r.e.c == (opts.biff >= 12 ? 0x3FFF : 0xFF) && !r.e.cRel) {
|
||||
return (r.s.rRel ? "" : "$") + encode_row(r.s.r) + ":" + (r.e.rRel ? "" : "$") + encode_row(r.e.r);
|
||||
}
|
||||
}
|
||||
@ -3788,6 +3792,12 @@ function write_XLWideString(data/*:string*/, o) {
|
||||
return _null ? o.slice(0, o.l) : o;
|
||||
}
|
||||
|
||||
/* [MS-XLSB] 2.5.91 */
|
||||
//function parse_LPWideString(data/*::, length*/)/*:string*/ {
|
||||
// var cchCharacters = data.read_shift(2);
|
||||
// return cchCharacters === 0 ? "" : data.read_shift(cchCharacters, "utf16le");
|
||||
//}
|
||||
|
||||
/* [MS-XLSB] 2.5.143 */
|
||||
function parse_StrRun(data) {
|
||||
return { ich: data.read_shift(2), ifnt: data.read_shift(2) };
|
||||
@ -3921,6 +3931,25 @@ function write_RfX(r/*:Range*/, o) {
|
||||
var parse_UncheckedRfX = parse_RfX;
|
||||
var write_UncheckedRfX = write_RfX;
|
||||
|
||||
/* [MS-XLSB] 2.5.155 UncheckedSqRfX */
|
||||
//function parse_UncheckedSqRfX(data) {
|
||||
// var cnt = data.read_shift(4);
|
||||
// var out = [];
|
||||
// for(var i = 0; i < cnt; ++i) {
|
||||
// var rng = parse_UncheckedRfX(data);
|
||||
// out.push(encode_range(rng));
|
||||
// }
|
||||
// return out.join(",");
|
||||
//}
|
||||
//function write_UncheckedSqRfX(sqrfx/*:string*/) {
|
||||
// var parts = sqrfx.split(/\s*,\s*/);
|
||||
// var o = new_buf(4); o.write_shift(4, parts.length);
|
||||
// var out = [o];
|
||||
// parts.forEach(function(rng) {
|
||||
// out.push(write_UncheckedRfX(safe_decode_range(rng)));
|
||||
// });
|
||||
// return bconcat(out);
|
||||
//}
|
||||
|
||||
/* [MS-XLS] 2.5.342 ; [MS-XLSB] 2.5.171 */
|
||||
/* TODO: error checking, NaN and Infinity values are not valid Xnum */
|
||||
@ -4155,7 +4184,7 @@ var SpecialProperties = {
|
||||
};
|
||||
|
||||
(function() {
|
||||
for(var y in SpecialProperties) if(SpecialProperties.hasOwnProperty(y))
|
||||
for(var y in SpecialProperties) if(Object.prototype.hasOwnProperty.call(SpecialProperties, y))
|
||||
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
|
||||
})();
|
||||
|
||||
@ -5111,7 +5140,7 @@ function xlml_write_custprops(Props, Custprops/*::, opts*/) {
|
||||
var o/*:Array<string>*/ = [];
|
||||
if(Props) keys(Props).forEach(function(k) {
|
||||
/*:: if(!Props) return; */
|
||||
if(!Props.hasOwnProperty(k)) return;
|
||||
if(!Object.prototype.hasOwnProperty.call(Props, k)) return;
|
||||
for(var i = 0; i < CORE_PROPS.length; ++i) if(k == CORE_PROPS[i][1]) return;
|
||||
for(i = 0; i < EXT_PROPS.length; ++i) if(k == EXT_PROPS[i][1]) return;
|
||||
for(i = 0; i < BLACKLIST.length; ++i) if(k == BLACKLIST[i]) return;
|
||||
@ -5125,8 +5154,8 @@ function xlml_write_custprops(Props, Custprops/*::, opts*/) {
|
||||
});
|
||||
if(Custprops) keys(Custprops).forEach(function(k) {
|
||||
/*:: if(!Custprops) return; */
|
||||
if(!Custprops.hasOwnProperty(k)) return;
|
||||
if(Props && Props.hasOwnProperty(k)) return;
|
||||
if(!Object.prototype.hasOwnProperty.call(Custprops, k)) return;
|
||||
if(Props && Object.prototype.hasOwnProperty.call(Props, k)) return;
|
||||
var m = Custprops[k];
|
||||
var t = "string";
|
||||
if(typeof m == 'number') { t = "float"; m = String(m); }
|
||||
@ -6093,7 +6122,7 @@ function write_Window1(/*::opts*/) {
|
||||
}
|
||||
/* [MS-XLS] 2.4.346 TODO */
|
||||
function parse_Window2(blob, length, opts) {
|
||||
if(opts && opts.biff >= 2 && opts.biff < 8) return {};
|
||||
if(opts && opts.biff >= 2 && opts.biff < 5) return {};
|
||||
var f = blob.read_shift(2);
|
||||
return { RTL: f & 0x40 };
|
||||
}
|
||||
@ -7596,13 +7625,13 @@ var PRN = (function() {
|
||||
}
|
||||
|
||||
cc = [];
|
||||
for(end in cnt) if ( cnt.hasOwnProperty(end) ) {
|
||||
for(end in cnt) if ( Object.prototype.hasOwnProperty.call(cnt, end) ) {
|
||||
cc.push([ cnt[end], end ]);
|
||||
}
|
||||
|
||||
if ( !cc.length ) {
|
||||
cnt = guess_sep_weights;
|
||||
for(end in cnt) if ( cnt.hasOwnProperty(end) ) {
|
||||
for(end in cnt) if ( Object.prototype.hasOwnProperty.call(cnt, end) ) {
|
||||
cc.push([ cnt[end], end ]);
|
||||
}
|
||||
}
|
||||
@ -9001,7 +9030,7 @@ function parse_fonts(t, styles, themes, opts) {
|
||||
break;
|
||||
|
||||
/* 18.8.29 name CT_FontName */
|
||||
case '<name': if(y.val) font.name = y.val; break;
|
||||
case '<name': if(y.val) font.name = utf8read(y.val); break;
|
||||
case '<name/>': case '</name>': break;
|
||||
|
||||
/* 18.8.2 b CT_BooleanProperty */
|
||||
@ -9240,11 +9269,11 @@ return function parse_sty_xml(data, themes, opts) {
|
||||
if((t=data.match(bordersRegex))) parse_borders(t, styles, themes, opts);
|
||||
|
||||
/* 18.8.9 cellStyleXfs CT_CellStyleXfs ? */
|
||||
/* 18.8.8 cellStyles CT_CellStyles ? */
|
||||
|
||||
/* 18.8.10 cellXfs CT_CellXfs ? */
|
||||
if((t=data.match(cellXfRegex))) parse_cellXfs(t, styles, opts);
|
||||
|
||||
/* 18.8.8 cellStyles CT_CellStyles ? */
|
||||
/* 18.8.15 dxfs CT_Dxfs ? */
|
||||
/* 18.8.42 tableStyles CT_TableStyles ? */
|
||||
/* 18.8.11 colors CT_Colors ? */
|
||||
@ -9670,6 +9699,13 @@ function write_sty_bin(wb, opts) {
|
||||
}
|
||||
RELS.THEME = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";
|
||||
|
||||
/* Even though theme layout is dk1 lt1 dk2 lt2, true order is lt1 dk1 lt2 dk2 */
|
||||
var XLSXThemeClrScheme = [
|
||||
'</a:lt1>', '</a:dk1>', '</a:lt2>', '</a:dk2>',
|
||||
'</a:accent1>', '</a:accent2>', '</a:accent3>',
|
||||
'</a:accent4>', '</a:accent5>', '</a:accent6>',
|
||||
'</a:hlink>', '</a:folHlink>'
|
||||
];
|
||||
/* 20.1.6.2 clrScheme CT_ColorScheme */
|
||||
function parse_clrScheme(t, themes, opts) {
|
||||
themes.themeElements.clrScheme = [];
|
||||
@ -9713,7 +9749,7 @@ function parse_clrScheme(t, themes, opts) {
|
||||
case '<a:hlink>': case '</a:hlink>':
|
||||
case '<a:folHlink>': case '</a:folHlink>':
|
||||
if (y[0].charAt(1) === '/') {
|
||||
themes.themeElements.clrScheme.push(color);
|
||||
themes.themeElements.clrScheme[XLSXThemeClrScheme.indexOf(y[0])] = color;
|
||||
color = {};
|
||||
} else {
|
||||
color.name = y[0].slice(3, y[0].length - 1);
|
||||
@ -10452,7 +10488,7 @@ var rc_to_a1 = (function(){
|
||||
};
|
||||
})();
|
||||
|
||||
var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)([1-9]\d{0,5}|10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6])(?![_.\(A-Za-z0-9])/g;
|
||||
var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})(?![_.\(A-Za-z0-9])/g;
|
||||
var a1_to_rc =(function(){
|
||||
return function a1_to_rc(fstr/*:string*/, base/*:CellAddress*/) {
|
||||
return fstr.replace(crefregex, function($0, $1, $2, $3, $4, $5) {
|
||||
@ -12972,7 +13008,7 @@ var browser_has_Map = typeof Map !== 'undefined';
|
||||
function get_sst_id(sst/*:SST*/, str/*:string*/, rev)/*:number*/ {
|
||||
var i = 0, len = sst.length;
|
||||
if(rev) {
|
||||
if(browser_has_Map ? rev.has(str) : rev.hasOwnProperty(str)) {
|
||||
if(browser_has_Map ? rev.has(str) : Object.prototype.hasOwnProperty.call(rev, str)) {
|
||||
var revarr = browser_has_Map ? rev.get(str) : rev[str];
|
||||
for(; i < revarr.length; ++i) {
|
||||
if(sst[revarr[i]].t === str) { sst.Count ++; return revarr[i]; }
|
||||
@ -12987,7 +13023,7 @@ function get_sst_id(sst/*:SST*/, str/*:string*/, rev)/*:number*/ {
|
||||
if(!rev.has(str)) rev.set(str, []);
|
||||
rev.get(str).push(len);
|
||||
} else {
|
||||
if(!rev.hasOwnProperty(str)) rev[str] = [];
|
||||
if(!Object.prototype.hasOwnProperty.call(rev, str)) rev[str] = [];
|
||||
rev[str].push(len);
|
||||
}
|
||||
}
|
||||
@ -15114,7 +15150,7 @@ function write_wb_xml(wb/*:Workbook*//*::, opts:?WriteOpts*/)/*:string*/ {
|
||||
if(n.Sheet != null) d.localSheetId = ""+n.Sheet;
|
||||
if(n.Hidden) d.hidden = "1";
|
||||
if(!n.Ref) return;
|
||||
o[o.length] = writextag('definedName', String(n.Ref).replace(/</g, "<").replace(/>/g, ">"), d);
|
||||
o[o.length] = writextag('definedName', escapexml(n.Ref), d);
|
||||
});
|
||||
o[o.length] = "</definedNames>";
|
||||
}
|
||||
@ -15632,7 +15668,10 @@ function parse_xlml_data(xml, ss, data, cell/*:any*/, base, styles, csty, row, a
|
||||
if(!cell.t) cell.t = 'n';
|
||||
break;
|
||||
case 'Error': cell.t = 'e'; cell.v = RBErr[xml]; if(o.cellText !== false) cell.w = xml; break;
|
||||
default: cell.t = 's'; cell.v = xlml_fixstr(ss||xml); break;
|
||||
default:
|
||||
if(xml == "" && ss == "") { cell.t = 'z'; }
|
||||
else { cell.t = 's'; cell.v = xlml_fixstr(ss||xml); }
|
||||
break;
|
||||
}
|
||||
safe_format_xlml(cell, nf, o);
|
||||
if(o.cellFormula !== false) {
|
||||
@ -16423,7 +16462,9 @@ function write_sty_xlml(wb, opts)/*:string*/ {
|
||||
opts.cellXfs.forEach(function(xf, id) {
|
||||
var payload/*:Array<string>*/ = [];
|
||||
payload.push(writextag('NumberFormat', null, {"ss:Format": escapexml(SSF._table[xf.numFmtId])}));
|
||||
styles.push(writextag('Style', payload.join(""), {"ss:ID": "s" + (21+id)}));
|
||||
|
||||
var o = /*::(*/{"ss:ID": "s" + (21+id)}/*:: :any)*/;
|
||||
styles.push(writextag('Style', payload.join(""), o));
|
||||
});
|
||||
return writextag("Styles", styles.join(""));
|
||||
}
|
||||
@ -17600,12 +17641,12 @@ function write_xls_props(wb/*:Workbook*/, cfb/*:CFBContainer*/) {
|
||||
if(wb.Props) {
|
||||
Keys = keys(wb.Props);
|
||||
// $FlowIgnore
|
||||
for(i = 0; i < Keys.length; ++i) (DocSummaryRE.hasOwnProperty(Keys[i]) ? DSEntries : SummaryRE.hasOwnProperty(Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Props[Keys[i]]]);
|
||||
for(i = 0; i < Keys.length; ++i) (Object.prototype.hasOwnProperty.call(DocSummaryRE, Keys[i]) ? DSEntries : Object.prototype.hasOwnProperty.call(SummaryRE, Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Props[Keys[i]]]);
|
||||
}
|
||||
if(wb.Custprops) {
|
||||
Keys = keys(wb.Custprops);
|
||||
// $FlowIgnore
|
||||
for(i = 0; i < Keys.length; ++i) if(!(wb.Props||{}).hasOwnProperty(Keys[i])) (DocSummaryRE.hasOwnProperty(Keys[i]) ? DSEntries : SummaryRE.hasOwnProperty(Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Custprops[Keys[i]]]);
|
||||
for(i = 0; i < Keys.length; ++i) if(!Object.prototype.hasOwnProperty.call((wb.Props||{}), Keys[i])) (Object.prototype.hasOwnProperty.call(DocSummaryRE, Keys[i]) ? DSEntries : Object.prototype.hasOwnProperty.call(SummaryRE, Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Custprops[Keys[i]]]);
|
||||
}
|
||||
var CEntries2 = [];
|
||||
for(i = 0; i < CEntries.length; ++i) {
|
||||
@ -18960,6 +19001,29 @@ function write_biff_rec(ba/*:BufArray*/, type/*:number|string*/, payload, length
|
||||
if(/*:: len != null &&*/len > 0 && is_buf(payload)) ba.push(payload);
|
||||
}
|
||||
|
||||
//function write_biff_continue(ba/*:BufArray*/, type/*:number|string*/, payload, length/*:?number*/)/*:void*/ {
|
||||
// var len = length || (payload||[]).length || 0;
|
||||
// if(len <= 8224) return write_biff_rec(ba, type, payload, len);
|
||||
// var t/*:number*/ = +type || +XLSRE[/*::String(*/type/*::)*/];
|
||||
// if(isNaN(t)) return;
|
||||
// var parts = payload.parts || [], sidx = 0;
|
||||
// var i = 0, w = 0;
|
||||
// while(w + (parts[sidx] || 8224) <= 8224) { w+= (parts[sidx] || 8224); sidx++; }
|
||||
// var o = ba.next(4);
|
||||
// o.write_shift(2, t);
|
||||
// o.write_shift(2, w);
|
||||
// ba.push(payload.slice(i, i + w));
|
||||
// i += w;
|
||||
// while(i < len) {
|
||||
// o = ba.next(4);
|
||||
// o.write_shift(2, 0x3c); // TODO: figure out correct continue type
|
||||
// w = 0;
|
||||
// while(w + (parts[sidx] || 8224) <= 8224) { w+= (parts[sidx] || 8224); sidx++; }
|
||||
// o.write_shift(2, w);
|
||||
// ba.push(payload.slice(i, i+w)); i+= w;
|
||||
// }
|
||||
//}
|
||||
|
||||
function write_BIFF2Cell(out, r/*:number*/, c/*:number*/) {
|
||||
if(!out) out = new_buf(7);
|
||||
out.write_shift(2, r);
|
||||
@ -19686,6 +19750,7 @@ var parse_content_xml = (function() {
|
||||
if(atag.Target) q.l = atag;
|
||||
if(comments.length > 0) { q.c = comments; comments = []; }
|
||||
if(textp && opts.cellText !== false) q.w = textp;
|
||||
if(isstub) { q.t = "z"; delete q.v; }
|
||||
if(!isstub || opts.sheetStubs) {
|
||||
if(!(opts.sheetRows && opts.sheetRows <= R)) {
|
||||
for(var rpt = 0; rpt < rowpeat; ++rpt) {
|
||||
@ -20177,6 +20242,11 @@ var write_content_ods/*:{(wb:any, opts:any):string}*/ = (function() {
|
||||
o.push(' <number:text>/</number:text>\n');
|
||||
o.push(' <number:year/>\n');
|
||||
o.push(' </number:date-style>\n');
|
||||
|
||||
o.push(' <style:style style:name="ta1" style:family="table">\n'); // style:master-page-name="mp1">\n');
|
||||
o.push(' <style:table-properties table:display="true" style:writing-mode="lr-tb"/>\n');
|
||||
o.push(' </style:style>\n');
|
||||
|
||||
o.push(' <style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>\n');
|
||||
o.push(' </office:automatic-styles>\n');
|
||||
};
|
||||
@ -20806,7 +20876,7 @@ function readSync(data/*:RawData*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
|
||||
if(typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) return readSync(new Uint8Array(data), opts);
|
||||
var d = data, n = [0,0,0,0], str = false;
|
||||
var o = opts||{};
|
||||
if(o.cellStyles) { o.cellNF = true; }
|
||||
if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; }
|
||||
_ssfopts = {};
|
||||
if(o.dateNF) _ssfopts.dateNF = o.dateNF;
|
||||
if(!o.type) o.type = (has_buf && Buffer.isBuffer(data)) ? "buffer" : "base64";
|
||||
@ -20851,7 +20921,6 @@ function write_cfb_ctr(cfb/*:CFBContainer*/, o/*:WriteOpts*/)/*:any*/ {
|
||||
return CFB.write(cfb, o);
|
||||
}
|
||||
|
||||
/*global encrypt_agile */
|
||||
/*:: declare var encrypt_agile:any; */
|
||||
function write_zip_type(wb/*:Workbook*/, opts/*:?WriteOpts*/)/*:any*/ {
|
||||
var o = opts||{};
|
||||
@ -20868,7 +20937,9 @@ function write_zip_type(wb/*:Workbook*/, opts/*:?WriteOpts*/)/*:any*/ {
|
||||
default: throw new Error("Unrecognized type " + o.type);
|
||||
}
|
||||
var out = z.FullPaths ? CFB.write(z, {fileType:"zip", type: /*::(*/{"nodebuffer": "buffer", "string": "binary"}/*:: :any)*/[oopts.type] || oopts.type}) : z.generate(oopts);
|
||||
if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.password), o);
|
||||
/*jshint -W083 */
|
||||
if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.password), o); // eslint-disable-line no-undef
|
||||
/*jshint +W083 */
|
||||
if(o.type === "file") return write_dl(o.file, out);
|
||||
return o.type == "string" ? utf8read(/*::(*/out/*:: :any)*/) : out;
|
||||
}
|
||||
@ -20929,7 +21000,7 @@ function writeSync(wb/*:Workbook*/, opts/*:?WriteOpts*/) {
|
||||
reset_cp();
|
||||
check_wb(wb);
|
||||
var o = opts||{};
|
||||
if(o.cellStyles) { o.cellNF = true; }
|
||||
if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; }
|
||||
if(o.type == "array") { o.type = "binary"; var out/*:string*/ = (writeSync(wb, o)/*:any*/); o.type = "array"; return s2ab(out); }
|
||||
switch(o.bookType || 'xlsb') {
|
||||
case 'xml':
|
||||
@ -20999,7 +21070,7 @@ type MJRObject = {
|
||||
*/
|
||||
function make_json_row(sheet/*:Worksheet*/, r/*:Range*/, R/*:number*/, cols/*:Array<string>*/, header/*:number*/, hdr/*:Array<any>*/, dense/*:boolean*/, o/*:Sheet2JSONOpts*/)/*:MJRObject*/ {
|
||||
var rr = encode_row(R);
|
||||
var defval = o.defval, raw = o.raw || !o.hasOwnProperty("raw");
|
||||
var defval = o.defval, raw = o.raw || !Object.prototype.hasOwnProperty.call(o, "raw");
|
||||
var isempty = true;
|
||||
var row/*:any*/ = (header === 1) ? [] : {};
|
||||
if(header !== 1) {
|
||||
|
141
xlsx.js
generated
141
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.15.5';
|
||||
XLSX.version = '0.15.6';
|
||||
var current_codepage = 1200, current_ansi = 1252;
|
||||
/*global cptable:true, window */
|
||||
if(typeof module !== "undefined" && typeof require !== 'undefined') {
|
||||
@ -192,7 +192,7 @@ var chr0 = /\u0000/g, chr1 = /[\u0001-\u0006]/g;
|
||||
/*jshint -W041 */
|
||||
var SSF = ({});
|
||||
var make_ssf = function make_ssf(SSF){
|
||||
SSF.version = '0.10.2';
|
||||
SSF.version = '0.10.3';
|
||||
function _strrev(x) { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; }
|
||||
function fill(c,l) { var o = ""; while(o.length < l) o+=c; return o; }
|
||||
function pad0(v,d){var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;}
|
||||
@ -356,7 +356,7 @@ function general_fmt(v, opts) {
|
||||
switch(typeof v) {
|
||||
case 'string': return v;
|
||||
case 'boolean': return v ? "TRUE" : "FALSE";
|
||||
case 'number': return (v|0) === v ? general_fmt_int(v) : general_fmt_num(v);
|
||||
case 'number': return (v|0) === v ? v.toString(10) : general_fmt_num(v);
|
||||
case 'undefined': return "";
|
||||
case 'object':
|
||||
if(v == null) return "";
|
||||
@ -736,7 +736,7 @@ function fmt_is_date(fmt) {
|
||||
while(i < fmt.length) {
|
||||
switch((c = fmt.charAt(i))) {
|
||||
case 'G': if(isgeneral(fmt, i)) i+= 6; i++; break;
|
||||
case '"': for(;(/*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;) ++i; ++i; break;
|
||||
case '"': for(;(/*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;){/*empty*/} ++i; break;
|
||||
case '\\': i+=2; break;
|
||||
case '_': i+=2; break;
|
||||
case '@': ++i; break;
|
||||
@ -845,6 +845,7 @@ function eval_fmt(fmt, v, opts, flen) {
|
||||
o = c; while(i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1) o+=fmt.charAt(i);
|
||||
out[out.length] = {t:'D', v:o}; break;
|
||||
case ' ': out[out.length] = {t:c, v:c}; ++i; break;
|
||||
case "$": out[out.length] = {t:'t', v:'$'}; ++i; break;
|
||||
default:
|
||||
if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized character ' + c + ' in ' + fmt);
|
||||
out[out.length] = {t:'t', v:c}; ++i; break;
|
||||
@ -1143,7 +1144,7 @@ var DO_NOT_EXPORT_CFB = true;
|
||||
/* vim: set ts=2: */
|
||||
/*jshint eqnull:true */
|
||||
/*exported CFB */
|
||||
/*global module, require:false, process:false, Buffer:false, Uint8Array:false, Uint16Array:false */
|
||||
/*global Uint8Array:false, Uint16Array:false */
|
||||
|
||||
/* crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
@ -1249,7 +1250,7 @@ CRC32.str = crc32_str;
|
||||
/* [MS-CFB] v20171201 */
|
||||
var CFB = (function _CFB(){
|
||||
var exports = {};
|
||||
exports.version = '1.1.3';
|
||||
exports.version = '1.1.4';
|
||||
/* [MS-CFB] 2.6.4 */
|
||||
function namecmp(l, r) {
|
||||
var L = l.split("/"), R = r.split("/");
|
||||
@ -1580,7 +1581,9 @@ function make_sector_list(sectors, dir_start, fat_addrs, ssz) {
|
||||
k = (i + dir_start); if(k >= sl) k-=sl;
|
||||
if(chkd[k]) continue;
|
||||
buf_chain = [];
|
||||
var seen = [];
|
||||
for(j=k; j>=0;) {
|
||||
seen[j] = true;
|
||||
chkd[j] = true;
|
||||
buf[buf.length] = j;
|
||||
buf_chain.push(sectors[j]);
|
||||
@ -1589,6 +1592,7 @@ function make_sector_list(sectors, dir_start, fat_addrs, ssz) {
|
||||
if(ssz < 4 + jj) throw new Error("FAT boundary crossed: " + j + " 4 "+ssz);
|
||||
if(!sectors[addr]) break;
|
||||
j = __readInt32LE(sectors[addr], jj);
|
||||
if(seen[j]) break;
|
||||
}
|
||||
sector_list[k] = ({nodes: buf, data:__toBuffer([buf_chain])});
|
||||
}
|
||||
@ -2589,7 +2593,7 @@ function blobify(data) {
|
||||
}
|
||||
/* write or download file */
|
||||
function write_dl(fname, payload, enc) {
|
||||
/*global IE_SaveFile, Blob, navigator, saveAs, URL, document, File, chrome */
|
||||
/*global IE_SaveFile, Blob, navigator, saveAs, document, File, chrome */
|
||||
if(typeof _fs !== 'undefined' && _fs.writeFileSync) return enc ? _fs.writeFileSync(fname, payload, enc) : _fs.writeFileSync(fname, payload);
|
||||
var data = (enc == "utf8") ? utf8write(payload) : payload;
|
||||
if(typeof IE_SaveFile !== 'undefined') return IE_SaveFile(data, fname);
|
||||
@ -2636,7 +2640,7 @@ function read_binary(path) {
|
||||
}
|
||||
function keys(o) {
|
||||
var ks = Object.keys(o), o2 = [];
|
||||
for(var i = 0; i < ks.length; ++i) if(o.hasOwnProperty(ks[i])) o2.push(ks[i]);
|
||||
for(var i = 0; i < ks.length; ++i) if(Object.prototype.hasOwnProperty.call(o, ks[i])) o2.push(ks[i]);
|
||||
return o2;
|
||||
}
|
||||
|
||||
@ -2741,7 +2745,7 @@ function dup(o) {
|
||||
if(typeof o != 'object' || o == null) return o;
|
||||
if(o instanceof Date) return new Date(o.getTime());
|
||||
var out = {};
|
||||
for(var k in o) if(o.hasOwnProperty(k)) out[k] = dup(o[k]);
|
||||
for(var k in o) if(Object.prototype.hasOwnProperty.call(o, k)) out[k] = dup(o[k]);
|
||||
return out;
|
||||
}
|
||||
|
||||
@ -2935,7 +2939,7 @@ var rencoding = evert(encodings);
|
||||
// TODO: CP remap (need to read file version to determine OS)
|
||||
var unescapexml = (function() {
|
||||
/* 22.4.2.4 bstr (Basic String) */
|
||||
var encregex = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/g, coderegex = /_x([\da-fA-F]{4})_/g;
|
||||
var encregex = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/ig, coderegex = /_x([\da-fA-F]{4})_/ig;
|
||||
return function unescapexml(text) {
|
||||
var s = text + '', i = s.indexOf("<![CDATA[");
|
||||
if(i == -1) return s.replace(encregex, function($$, $1) { return encodings[$$]||String.fromCharCode(parseInt($1,$$.indexOf("x")>-1?16:10))||$$; }).replace(coderegex,function(m,c) {return String.fromCharCode(parseInt(c,16));});
|
||||
@ -3062,7 +3066,7 @@ var htmldecode = (function() {
|
||||
var entities = [
|
||||
['nbsp', ' '], ['middot', '·'],
|
||||
['quot', '"'], ['apos', "'"], ['gt', '>'], ['lt', '<'], ['amp', '&']
|
||||
].map(function(x) { return [new RegExp('&' + x[0] + ';', "g"), x[1]]; });
|
||||
].map(function(x) { return [new RegExp('&' + x[0] + ';', "ig"), x[1]]; });
|
||||
return function htmldecode(str) {
|
||||
var o = str
|
||||
// Remove new lines and spaces from start of content
|
||||
@ -3497,7 +3501,7 @@ function encode_range_xls(r, opts) {
|
||||
}
|
||||
}
|
||||
if(r.s.c == 0 && !r.s.cRel) {
|
||||
if(r.e.c == (opts.biff >= 12 ? 0xFFFF : 0xFF) && !r.e.cRel) {
|
||||
if(r.e.c == (opts.biff >= 12 ? 0x3FFF : 0xFF) && !r.e.cRel) {
|
||||
return (r.s.rRel ? "" : "$") + encode_row(r.s.r) + ":" + (r.e.rRel ? "" : "$") + encode_row(r.e.r);
|
||||
}
|
||||
}
|
||||
@ -3695,6 +3699,12 @@ function write_XLWideString(data, o) {
|
||||
return _null ? o.slice(0, o.l) : o;
|
||||
}
|
||||
|
||||
/* [MS-XLSB] 2.5.91 */
|
||||
//function parse_LPWideString(data) {
|
||||
// var cchCharacters = data.read_shift(2);
|
||||
// return cchCharacters === 0 ? "" : data.read_shift(cchCharacters, "utf16le");
|
||||
//}
|
||||
|
||||
/* [MS-XLSB] 2.5.143 */
|
||||
function parse_StrRun(data) {
|
||||
return { ich: data.read_shift(2), ifnt: data.read_shift(2) };
|
||||
@ -3828,6 +3838,25 @@ function write_RfX(r, o) {
|
||||
var parse_UncheckedRfX = parse_RfX;
|
||||
var write_UncheckedRfX = write_RfX;
|
||||
|
||||
/* [MS-XLSB] 2.5.155 UncheckedSqRfX */
|
||||
//function parse_UncheckedSqRfX(data) {
|
||||
// var cnt = data.read_shift(4);
|
||||
// var out = [];
|
||||
// for(var i = 0; i < cnt; ++i) {
|
||||
// var rng = parse_UncheckedRfX(data);
|
||||
// out.push(encode_range(rng));
|
||||
// }
|
||||
// return out.join(",");
|
||||
//}
|
||||
//function write_UncheckedSqRfX(sqrfx) {
|
||||
// var parts = sqrfx.split(/\s*,\s*/);
|
||||
// var o = new_buf(4); o.write_shift(4, parts.length);
|
||||
// var out = [o];
|
||||
// parts.forEach(function(rng) {
|
||||
// out.push(write_UncheckedRfX(safe_decode_range(rng)));
|
||||
// });
|
||||
// return bconcat(out);
|
||||
//}
|
||||
|
||||
/* [MS-XLS] 2.5.342 ; [MS-XLSB] 2.5.171 */
|
||||
/* TODO: error checking, NaN and Infinity values are not valid Xnum */
|
||||
@ -4062,7 +4091,7 @@ var SpecialProperties = {
|
||||
};
|
||||
|
||||
(function() {
|
||||
for(var y in SpecialProperties) if(SpecialProperties.hasOwnProperty(y))
|
||||
for(var y in SpecialProperties) if(Object.prototype.hasOwnProperty.call(SpecialProperties, y))
|
||||
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
|
||||
})();
|
||||
|
||||
@ -5017,7 +5046,7 @@ function xlml_write_custprops(Props, Custprops) {
|
||||
var T = 'CustomDocumentProperties';
|
||||
var o = [];
|
||||
if(Props) keys(Props).forEach(function(k) {
|
||||
if(!Props.hasOwnProperty(k)) return;
|
||||
if(!Object.prototype.hasOwnProperty.call(Props, k)) return;
|
||||
for(var i = 0; i < CORE_PROPS.length; ++i) if(k == CORE_PROPS[i][1]) return;
|
||||
for(i = 0; i < EXT_PROPS.length; ++i) if(k == EXT_PROPS[i][1]) return;
|
||||
for(i = 0; i < BLACKLIST.length; ++i) if(k == BLACKLIST[i]) return;
|
||||
@ -5030,8 +5059,8 @@ if(!Props.hasOwnProperty(k)) return;
|
||||
o.push(writextag(escapexmltag(k), m, {"dt:dt":t}));
|
||||
});
|
||||
if(Custprops) keys(Custprops).forEach(function(k) {
|
||||
if(!Custprops.hasOwnProperty(k)) return;
|
||||
if(Props && Props.hasOwnProperty(k)) return;
|
||||
if(!Object.prototype.hasOwnProperty.call(Custprops, k)) return;
|
||||
if(Props && Object.prototype.hasOwnProperty.call(Props, k)) return;
|
||||
var m = Custprops[k];
|
||||
var t = "string";
|
||||
if(typeof m == 'number') { t = "float"; m = String(m); }
|
||||
@ -5996,7 +6025,7 @@ function write_Window1() {
|
||||
}
|
||||
/* [MS-XLS] 2.4.346 TODO */
|
||||
function parse_Window2(blob, length, opts) {
|
||||
if(opts && opts.biff >= 2 && opts.biff < 8) return {};
|
||||
if(opts && opts.biff >= 2 && opts.biff < 5) return {};
|
||||
var f = blob.read_shift(2);
|
||||
return { RTL: f & 0x40 };
|
||||
}
|
||||
@ -7498,13 +7527,13 @@ var PRN = (function() {
|
||||
}
|
||||
|
||||
cc = [];
|
||||
for(end in cnt) if ( cnt.hasOwnProperty(end) ) {
|
||||
for(end in cnt) if ( Object.prototype.hasOwnProperty.call(cnt, end) ) {
|
||||
cc.push([ cnt[end], end ]);
|
||||
}
|
||||
|
||||
if ( !cc.length ) {
|
||||
cnt = guess_sep_weights;
|
||||
for(end in cnt) if ( cnt.hasOwnProperty(end) ) {
|
||||
for(end in cnt) if ( Object.prototype.hasOwnProperty.call(cnt, end) ) {
|
||||
cc.push([ cnt[end], end ]);
|
||||
}
|
||||
}
|
||||
@ -8902,7 +8931,7 @@ function parse_fonts(t, styles, themes, opts) {
|
||||
break;
|
||||
|
||||
/* 18.8.29 name CT_FontName */
|
||||
case '<name': if(y.val) font.name = y.val; break;
|
||||
case '<name': if(y.val) font.name = utf8read(y.val); break;
|
||||
case '<name/>': case '</name>': break;
|
||||
|
||||
/* 18.8.2 b CT_BooleanProperty */
|
||||
@ -9141,11 +9170,11 @@ return function parse_sty_xml(data, themes, opts) {
|
||||
if((t=data.match(bordersRegex))) parse_borders(t, styles, themes, opts);
|
||||
|
||||
/* 18.8.9 cellStyleXfs CT_CellStyleXfs ? */
|
||||
/* 18.8.8 cellStyles CT_CellStyles ? */
|
||||
|
||||
/* 18.8.10 cellXfs CT_CellXfs ? */
|
||||
if((t=data.match(cellXfRegex))) parse_cellXfs(t, styles, opts);
|
||||
|
||||
/* 18.8.8 cellStyles CT_CellStyles ? */
|
||||
/* 18.8.15 dxfs CT_Dxfs ? */
|
||||
/* 18.8.42 tableStyles CT_TableStyles ? */
|
||||
/* 18.8.11 colors CT_Colors ? */
|
||||
@ -9569,6 +9598,13 @@ function write_sty_bin(wb, opts) {
|
||||
}
|
||||
RELS.THEME = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";
|
||||
|
||||
/* Even though theme layout is dk1 lt1 dk2 lt2, true order is lt1 dk1 lt2 dk2 */
|
||||
var XLSXThemeClrScheme = [
|
||||
'</a:lt1>', '</a:dk1>', '</a:lt2>', '</a:dk2>',
|
||||
'</a:accent1>', '</a:accent2>', '</a:accent3>',
|
||||
'</a:accent4>', '</a:accent5>', '</a:accent6>',
|
||||
'</a:hlink>', '</a:folHlink>'
|
||||
];
|
||||
/* 20.1.6.2 clrScheme CT_ColorScheme */
|
||||
function parse_clrScheme(t, themes, opts) {
|
||||
themes.themeElements.clrScheme = [];
|
||||
@ -9612,7 +9648,7 @@ function parse_clrScheme(t, themes, opts) {
|
||||
case '<a:hlink>': case '</a:hlink>':
|
||||
case '<a:folHlink>': case '</a:folHlink>':
|
||||
if (y[0].charAt(1) === '/') {
|
||||
themes.themeElements.clrScheme.push(color);
|
||||
themes.themeElements.clrScheme[XLSXThemeClrScheme.indexOf(y[0])] = color;
|
||||
color = {};
|
||||
} else {
|
||||
color.name = y[0].slice(3, y[0].length - 1);
|
||||
@ -10351,7 +10387,7 @@ var rc_to_a1 = (function(){
|
||||
};
|
||||
})();
|
||||
|
||||
var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)([1-9]\d{0,5}|10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6])(?![_.\(A-Za-z0-9])/g;
|
||||
var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})(?![_.\(A-Za-z0-9])/g;
|
||||
var a1_to_rc =(function(){
|
||||
return function a1_to_rc(fstr, base) {
|
||||
return fstr.replace(crefregex, function($0, $1, $2, $3, $4, $5) {
|
||||
@ -12870,7 +12906,7 @@ var browser_has_Map = typeof Map !== 'undefined';
|
||||
function get_sst_id(sst, str, rev) {
|
||||
var i = 0, len = sst.length;
|
||||
if(rev) {
|
||||
if(browser_has_Map ? rev.has(str) : rev.hasOwnProperty(str)) {
|
||||
if(browser_has_Map ? rev.has(str) : Object.prototype.hasOwnProperty.call(rev, str)) {
|
||||
var revarr = browser_has_Map ? rev.get(str) : rev[str];
|
||||
for(; i < revarr.length; ++i) {
|
||||
if(sst[revarr[i]].t === str) { sst.Count ++; return revarr[i]; }
|
||||
@ -12885,7 +12921,7 @@ function get_sst_id(sst, str, rev) {
|
||||
if(!rev.has(str)) rev.set(str, []);
|
||||
rev.get(str).push(len);
|
||||
} else {
|
||||
if(!rev.hasOwnProperty(str)) rev[str] = [];
|
||||
if(!Object.prototype.hasOwnProperty.call(rev, str)) rev[str] = [];
|
||||
rev[str].push(len);
|
||||
}
|
||||
}
|
||||
@ -15009,7 +15045,7 @@ if(wb.Workbook.WBProps.CodeName) { workbookPr.codeName = wb.Workbook.WBProps.Cod
|
||||
if(n.Sheet != null) d.localSheetId = ""+n.Sheet;
|
||||
if(n.Hidden) d.hidden = "1";
|
||||
if(!n.Ref) return;
|
||||
o[o.length] = writextag('definedName', String(n.Ref).replace(/</g, "<").replace(/>/g, ">"), d);
|
||||
o[o.length] = writextag('definedName', escapexml(n.Ref), d);
|
||||
});
|
||||
o[o.length] = "</definedNames>";
|
||||
}
|
||||
@ -15525,7 +15561,10 @@ function parse_xlml_data(xml, ss, data, cell, base, styles, csty, row, arrayf, o
|
||||
if(!cell.t) cell.t = 'n';
|
||||
break;
|
||||
case 'Error': cell.t = 'e'; cell.v = RBErr[xml]; if(o.cellText !== false) cell.w = xml; break;
|
||||
default: cell.t = 's'; cell.v = xlml_fixstr(ss||xml); break;
|
||||
default:
|
||||
if(xml == "" && ss == "") { cell.t = 'z'; }
|
||||
else { cell.t = 's'; cell.v = xlml_fixstr(ss||xml); }
|
||||
break;
|
||||
}
|
||||
safe_format_xlml(cell, nf, o);
|
||||
if(o.cellFormula !== false) {
|
||||
@ -16313,7 +16352,9 @@ function write_sty_xlml(wb, opts) {
|
||||
opts.cellXfs.forEach(function(xf, id) {
|
||||
var payload = [];
|
||||
payload.push(writextag('NumberFormat', null, {"ss:Format": escapexml(SSF._table[xf.numFmtId])}));
|
||||
styles.push(writextag('Style', payload.join(""), {"ss:ID": "s" + (21+id)}));
|
||||
|
||||
var o = {"ss:ID": "s" + (21+id)};
|
||||
styles.push(writextag('Style', payload.join(""), o));
|
||||
});
|
||||
return writextag("Styles", styles.join(""));
|
||||
}
|
||||
@ -17483,12 +17524,12 @@ function write_xls_props(wb, cfb) {
|
||||
if(wb.Props) {
|
||||
Keys = keys(wb.Props);
|
||||
// $FlowIgnore
|
||||
for(i = 0; i < Keys.length; ++i) (DocSummaryRE.hasOwnProperty(Keys[i]) ? DSEntries : SummaryRE.hasOwnProperty(Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Props[Keys[i]]]);
|
||||
for(i = 0; i < Keys.length; ++i) (Object.prototype.hasOwnProperty.call(DocSummaryRE, Keys[i]) ? DSEntries : Object.prototype.hasOwnProperty.call(SummaryRE, Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Props[Keys[i]]]);
|
||||
}
|
||||
if(wb.Custprops) {
|
||||
Keys = keys(wb.Custprops);
|
||||
// $FlowIgnore
|
||||
for(i = 0; i < Keys.length; ++i) if(!(wb.Props||{}).hasOwnProperty(Keys[i])) (DocSummaryRE.hasOwnProperty(Keys[i]) ? DSEntries : SummaryRE.hasOwnProperty(Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Custprops[Keys[i]]]);
|
||||
for(i = 0; i < Keys.length; ++i) if(!Object.prototype.hasOwnProperty.call((wb.Props||{}), Keys[i])) (Object.prototype.hasOwnProperty.call(DocSummaryRE, Keys[i]) ? DSEntries : Object.prototype.hasOwnProperty.call(SummaryRE, Keys[i]) ? SEntries : CEntries).push([Keys[i], wb.Custprops[Keys[i]]]);
|
||||
}
|
||||
var CEntries2 = [];
|
||||
for(i = 0; i < CEntries.length; ++i) {
|
||||
@ -18843,6 +18884,29 @@ function write_biff_rec(ba, type, payload, length) {
|
||||
if(len > 0 && is_buf(payload)) ba.push(payload);
|
||||
}
|
||||
|
||||
//function write_biff_continue(ba, type, payload, length) {
|
||||
// var len = length || (payload||[]).length || 0;
|
||||
// if(len <= 8224) return write_biff_rec(ba, type, payload, len);
|
||||
// var t = +type || +XLSRE[type];
|
||||
// if(isNaN(t)) return;
|
||||
// var parts = payload.parts || [], sidx = 0;
|
||||
// var i = 0, w = 0;
|
||||
// while(w + (parts[sidx] || 8224) <= 8224) { w+= (parts[sidx] || 8224); sidx++; }
|
||||
// var o = ba.next(4);
|
||||
// o.write_shift(2, t);
|
||||
// o.write_shift(2, w);
|
||||
// ba.push(payload.slice(i, i + w));
|
||||
// i += w;
|
||||
// while(i < len) {
|
||||
// o = ba.next(4);
|
||||
// o.write_shift(2, 0x3c); // TODO: figure out correct continue type
|
||||
// w = 0;
|
||||
// while(w + (parts[sidx] || 8224) <= 8224) { w+= (parts[sidx] || 8224); sidx++; }
|
||||
// o.write_shift(2, w);
|
||||
// ba.push(payload.slice(i, i+w)); i+= w;
|
||||
// }
|
||||
//}
|
||||
|
||||
function write_BIFF2Cell(out, r, c) {
|
||||
if(!out) out = new_buf(7);
|
||||
out.write_shift(2, r);
|
||||
@ -19568,6 +19632,7 @@ var parse_content_xml = (function() {
|
||||
if(atag.Target) q.l = atag;
|
||||
if(comments.length > 0) { q.c = comments; comments = []; }
|
||||
if(textp && opts.cellText !== false) q.w = textp;
|
||||
if(isstub) { q.t = "z"; delete q.v; }
|
||||
if(!isstub || opts.sheetStubs) {
|
||||
if(!(opts.sheetRows && opts.sheetRows <= R)) {
|
||||
for(var rpt = 0; rpt < rowpeat; ++rpt) {
|
||||
@ -20059,6 +20124,11 @@ var write_content_ods = (function() {
|
||||
o.push(' <number:text>/</number:text>\n');
|
||||
o.push(' <number:year/>\n');
|
||||
o.push(' </number:date-style>\n');
|
||||
|
||||
o.push(' <style:style style:name="ta1" style:family="table">\n'); // style:master-page-name="mp1">\n');
|
||||
o.push(' <style:table-properties table:display="true" style:writing-mode="lr-tb"/>\n');
|
||||
o.push(' </style:style>\n');
|
||||
|
||||
o.push(' <style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>\n');
|
||||
o.push(' </office:automatic-styles>\n');
|
||||
};
|
||||
@ -20682,7 +20752,7 @@ function readSync(data, opts) {
|
||||
if(typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) return readSync(new Uint8Array(data), opts);
|
||||
var d = data, n = [0,0,0,0], str = false;
|
||||
var o = opts||{};
|
||||
if(o.cellStyles) { o.cellNF = true; }
|
||||
if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; }
|
||||
_ssfopts = {};
|
||||
if(o.dateNF) _ssfopts.dateNF = o.dateNF;
|
||||
if(!o.type) o.type = (has_buf && Buffer.isBuffer(data)) ? "buffer" : "base64";
|
||||
@ -20727,7 +20797,6 @@ function write_cfb_ctr(cfb, o) {
|
||||
return CFB.write(cfb, o);
|
||||
}
|
||||
|
||||
/*global encrypt_agile */
|
||||
function write_zip_type(wb, opts) {
|
||||
var o = opts||{};
|
||||
var z = write_zip(wb, o);
|
||||
@ -20743,7 +20812,9 @@ function write_zip_type(wb, opts) {
|
||||
default: throw new Error("Unrecognized type " + o.type);
|
||||
}
|
||||
var out = z.FullPaths ? CFB.write(z, {fileType:"zip", type: {"nodebuffer": "buffer", "string": "binary"}[oopts.type] || oopts.type}) : z.generate(oopts);
|
||||
if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.password), o);
|
||||
/*jshint -W083 */
|
||||
if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.password), o); // eslint-disable-line no-undef
|
||||
/*jshint +W083 */
|
||||
if(o.type === "file") return write_dl(o.file, out);
|
||||
return o.type == "string" ? utf8read(out) : out;
|
||||
}
|
||||
@ -20804,7 +20875,7 @@ function writeSync(wb, opts) {
|
||||
reset_cp();
|
||||
check_wb(wb);
|
||||
var o = opts||{};
|
||||
if(o.cellStyles) { o.cellNF = true; }
|
||||
if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; }
|
||||
if(o.type == "array") { o.type = "binary"; var out = (writeSync(wb, o)); o.type = "array"; return s2ab(out); }
|
||||
switch(o.bookType || 'xlsb') {
|
||||
case 'xml':
|
||||
@ -20868,7 +20939,7 @@ function writeFileAsync(filename, wb, opts, cb) {
|
||||
}
|
||||
function make_json_row(sheet, r, R, cols, header, hdr, dense, o) {
|
||||
var rr = encode_row(R);
|
||||
var defval = o.defval, raw = o.raw || !o.hasOwnProperty("raw");
|
||||
var defval = o.defval, raw = o.raw || !Object.prototype.hasOwnProperty.call(o, "raw");
|
||||
var isempty = true;
|
||||
var row = (header === 1) ? [] : {};
|
||||
if(header !== 1) {
|
||||
|
@ -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.15.5';
|
||||
XLSX.version = '0.15.6';
|
||||
var current_codepage = 1200, current_ansi = 1252;
|
||||
|
||||
var VALID_ANSI = [ 874, 932, 936, 949, 950 ];
|
||||
@ -191,7 +191,7 @@ type WriteObjStrFactory = {from_sheet(ws:Worksheet, o:any, wb:?Workbook):string}
|
||||
/*jshint -W041 */
|
||||
var SSF/*:SSFModule*/ = ({}/*:any*/);
|
||||
var make_ssf = function make_ssf(SSF/*:SSFModule*/){
|
||||
SSF.version = '0.10.2';
|
||||
SSF.version = '0.10.3';
|
||||
function _strrev(x/*:string*/)/*:string*/ { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; }
|
||||
function fill(c/*:string*/,l/*:number*/)/*:string*/ { var o = ""; while(o.length < l) o+=c; return o; }
|
||||
function pad0(v/*:any*/,d/*:number*/)/*:string*/{var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;}
|
||||
@ -358,7 +358,7 @@ function general_fmt(v/*:any*/, opts/*:any*/) {
|
||||
switch(typeof v) {
|
||||
case 'string': return v;
|
||||
case 'boolean': return v ? "TRUE" : "FALSE";
|
||||
case 'number': return (v|0) === v ? general_fmt_int(v) : general_fmt_num(v);
|
||||
case 'number': return (v|0) === v ? v.toString(10) : general_fmt_num(v);
|
||||
case 'undefined': return "";
|
||||
case 'object':
|
||||
if(v == null) return "";
|
||||
@ -741,7 +741,7 @@ function fmt_is_date(fmt/*:string*/)/*:boolean*/ {
|
||||
while(i < fmt.length) {
|
||||
switch((c = fmt.charAt(i))) {
|
||||
case 'G': if(isgeneral(fmt, i)) i+= 6; i++; break;
|
||||
case '"': for(;(/*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;) ++i; ++i; break;
|
||||
case '"': for(;(/*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;){/*empty*/} ++i; break;
|
||||
case '\\': i+=2; break;
|
||||
case '_': i+=2; break;
|
||||
case '@': ++i; break;
|
||||
@ -850,6 +850,7 @@ function eval_fmt(fmt/*:string*/, v/*:any*/, opts/*:any*/, flen/*:number*/) {
|
||||
o = c; while(i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1) o+=fmt.charAt(i);
|
||||
out[out.length] = {t:'D', v:o}; break;
|
||||
case ' ': out[out.length] = {t:c, v:c}; ++i; break;
|
||||
case "$": out[out.length] = {t:'t', v:'$'}; ++i; break;
|
||||
default:
|
||||
if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized character ' + c + ' in ' + fmt);
|
||||
out[out.length] = {t:'t', v:c}; ++i; break;
|
||||
@ -1173,7 +1174,7 @@ declare var new_unsafe_buf:any;
|
||||
/* vim: set ts=2: */
|
||||
/*jshint eqnull:true */
|
||||
/*exported CFB */
|
||||
/*global module, require:false, process:false, Buffer:false, Uint8Array:false, Uint16Array:false */
|
||||
/*global Uint8Array:false, Uint16Array:false */
|
||||
|
||||
/*::
|
||||
declare var DO_NOT_EXPORT_CFB:?boolean;
|
||||
@ -1294,7 +1295,7 @@ CRC32.str = crc32_str;
|
||||
/* [MS-CFB] v20171201 */
|
||||
var CFB = (function _CFB(){
|
||||
var exports/*:CFBModule*/ = /*::(*/{}/*:: :any)*/;
|
||||
exports.version = '1.1.3';
|
||||
exports.version = '1.1.4';
|
||||
/* [MS-CFB] 2.6.4 */
|
||||
function namecmp(l/*:string*/, r/*:string*/)/*:number*/ {
|
||||
var L = l.split("/"), R = r.split("/");
|
||||
@ -1625,7 +1626,9 @@ function make_sector_list(sectors/*:Array<RawBytes>*/, dir_start/*:number*/, fat
|
||||
k = (i + dir_start); if(k >= sl) k-=sl;
|
||||
if(chkd[k]) continue;
|
||||
buf_chain = [];
|
||||
var seen = [];
|
||||
for(j=k; j>=0;) {
|
||||
seen[j] = true;
|
||||
chkd[j] = true;
|
||||
buf[buf.length] = j;
|
||||
buf_chain.push(sectors[j]);
|
||||
@ -1634,6 +1637,7 @@ function make_sector_list(sectors/*:Array<RawBytes>*/, dir_start/*:number*/, fat
|
||||
if(ssz < 4 + jj) throw new Error("FAT boundary crossed: " + j + " 4 "+ssz);
|
||||
if(!sectors[addr]) break;
|
||||
j = __readInt32LE(sectors[addr], jj);
|
||||
if(seen[j]) break;
|
||||
}
|
||||
sector_list[k] = ({nodes: buf, data:__toBuffer([buf_chain])}/*:SectorEntry*/);
|
||||
}
|
||||
@ -2641,7 +2645,7 @@ function blobify(data) {
|
||||
}
|
||||
/* write or download file */
|
||||
function write_dl(fname/*:string*/, payload/*:any*/, enc/*:?string*/) {
|
||||
/*global IE_SaveFile, Blob, navigator, saveAs, URL, document, File, chrome */
|
||||
/*global IE_SaveFile, Blob, navigator, saveAs, document, File, chrome */
|
||||
if(typeof _fs !== 'undefined' && _fs.writeFileSync) return enc ? _fs.writeFileSync(fname, payload, enc) : _fs.writeFileSync(fname, payload);
|
||||
var data = (enc == "utf8") ? utf8write(payload) : payload;
|
||||
/*:: declare var IE_SaveFile: any; */
|
||||
@ -2693,7 +2697,7 @@ function read_binary(path/*:string*/) {
|
||||
}
|
||||
function keys(o/*:any*/)/*:Array<any>*/ {
|
||||
var ks = Object.keys(o), o2 = [];
|
||||
for(var i = 0; i < ks.length; ++i) if(o.hasOwnProperty(ks[i])) o2.push(ks[i]);
|
||||
for(var i = 0; i < ks.length; ++i) if(Object.prototype.hasOwnProperty.call(o, ks[i])) o2.push(ks[i]);
|
||||
return o2;
|
||||
}
|
||||
|
||||
@ -2799,7 +2803,7 @@ function dup(o/*:any*/)/*:any*/ {
|
||||
if(typeof o != 'object' || o == null) return o;
|
||||
if(o instanceof Date) return new Date(o.getTime());
|
||||
var out = {};
|
||||
for(var k in o) if(o.hasOwnProperty(k)) out[k] = dup(o[k]);
|
||||
for(var k in o) if(Object.prototype.hasOwnProperty.call(o, k)) out[k] = dup(o[k]);
|
||||
return out;
|
||||
}
|
||||
|
||||
@ -2978,7 +2982,7 @@ var rencoding = evert(encodings);
|
||||
// TODO: CP remap (need to read file version to determine OS)
|
||||
var unescapexml/*:StringConv*/ = (function() {
|
||||
/* 22.4.2.4 bstr (Basic String) */
|
||||
var encregex = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/g, coderegex = /_x([\da-fA-F]{4})_/g;
|
||||
var encregex = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/ig, coderegex = /_x([\da-fA-F]{4})_/ig;
|
||||
return function unescapexml(text/*:string*/)/*:string*/ {
|
||||
var s = text + '', i = s.indexOf("<![CDATA[");
|
||||
if(i == -1) return s.replace(encregex, function($$, $1) { return encodings[$$]||String.fromCharCode(parseInt($1,$$.indexOf("x")>-1?16:10))||$$; }).replace(coderegex,function(m,c) {return String.fromCharCode(parseInt(c,16));});
|
||||
@ -3105,7 +3109,7 @@ var htmldecode/*:{(s:string):string}*/ = (function() {
|
||||
var entities/*:Array<[RegExp, string]>*/ = [
|
||||
['nbsp', ' '], ['middot', '·'],
|
||||
['quot', '"'], ['apos', "'"], ['gt', '>'], ['lt', '<'], ['amp', '&']
|
||||
].map(function(x/*:[string, string]*/) { return [new RegExp('&' + x[0] + ';', "g"), x[1]]; });
|
||||
].map(function(x/*:[string, string]*/) { return [new RegExp('&' + x[0] + ';', "ig"), x[1]]; });
|
||||
return function htmldecode(str/*:string*/)/*:string*/ {
|
||||
var o = str
|
||||
// Remove new lines and spaces from start of content
|
||||
@ -3546,7 +3550,7 @@ function encode_range_xls(r, opts)/*:string*/ {
|
||||
}
|
||||
}
|
||||
if(r.s.c == 0 && !r.s.cRel) {
|
||||
if(r.e.c == (opts.biff >= 12 ? 0xFFFF : 0xFF) && !r.e.cRel) {
|
||||
if(r.e.c == (opts.biff >= 12 ? 0x3FFF : 0xFF) && !r.e.cRel) {
|
||||
return (r.s.rRel ? "" : "$") + encode_row(r.s.r) + ":" + (r.e.rRel ? "" : "$") + encode_row(r.e.r);
|
||||
}
|
||||
}
|
||||
@ -3797,7 +3801,7 @@ var SpecialProperties = {
|
||||
};
|
||||
|
||||
(function() {
|
||||
for(var y in SpecialProperties) if(SpecialProperties.hasOwnProperty(y))
|
||||
for(var y in SpecialProperties) if(Object.prototype.hasOwnProperty.call(SpecialProperties, y))
|
||||
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
|
||||
})();
|
||||
|
||||
@ -5137,7 +5141,7 @@ function parse_fonts(t, styles, themes, opts) {
|
||||
break;
|
||||
|
||||
/* 18.8.29 name CT_FontName */
|
||||
case '<name': if(y.val) font.name = y.val; break;
|
||||
case '<name': if(y.val) font.name = utf8read(y.val); break;
|
||||
case '<name/>': case '</name>': break;
|
||||
|
||||
/* 18.8.2 b CT_BooleanProperty */
|
||||
@ -5376,11 +5380,11 @@ return function parse_sty_xml(data, themes, opts) {
|
||||
if((t=data.match(bordersRegex))) parse_borders(t, styles, themes, opts);
|
||||
|
||||
/* 18.8.9 cellStyleXfs CT_CellStyleXfs ? */
|
||||
/* 18.8.8 cellStyles CT_CellStyles ? */
|
||||
|
||||
/* 18.8.10 cellXfs CT_CellXfs ? */
|
||||
if((t=data.match(cellXfRegex))) parse_cellXfs(t, styles, opts);
|
||||
|
||||
/* 18.8.8 cellStyles CT_CellStyles ? */
|
||||
/* 18.8.15 dxfs CT_Dxfs ? */
|
||||
/* 18.8.42 tableStyles CT_TableStyles ? */
|
||||
/* 18.8.11 colors CT_Colors ? */
|
||||
@ -5414,6 +5418,13 @@ function write_sty_xml(wb/*:Workbook*/, opts)/*:string*/ {
|
||||
}
|
||||
RELS.THEME = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";
|
||||
|
||||
/* Even though theme layout is dk1 lt1 dk2 lt2, true order is lt1 dk1 lt2 dk2 */
|
||||
var XLSXThemeClrScheme = [
|
||||
'</a:lt1>', '</a:dk1>', '</a:lt2>', '</a:dk2>',
|
||||
'</a:accent1>', '</a:accent2>', '</a:accent3>',
|
||||
'</a:accent4>', '</a:accent5>', '</a:accent6>',
|
||||
'</a:hlink>', '</a:folHlink>'
|
||||
];
|
||||
/* 20.1.6.2 clrScheme CT_ColorScheme */
|
||||
function parse_clrScheme(t, themes, opts) {
|
||||
themes.themeElements.clrScheme = [];
|
||||
@ -5457,7 +5468,7 @@ function parse_clrScheme(t, themes, opts) {
|
||||
case '<a:hlink>': case '</a:hlink>':
|
||||
case '<a:folHlink>': case '</a:folHlink>':
|
||||
if (y[0].charAt(1) === '/') {
|
||||
themes.themeElements.clrScheme.push(color);
|
||||
themes.themeElements.clrScheme[XLSXThemeClrScheme.indexOf(y[0])] = color;
|
||||
color = {};
|
||||
} else {
|
||||
color.name = y[0].slice(3, y[0].length - 1);
|
||||
@ -5955,7 +5966,7 @@ var rc_to_a1 = (function(){
|
||||
};
|
||||
})();
|
||||
|
||||
var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)([1-9]\d{0,5}|10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6])(?![_.\(A-Za-z0-9])/g;
|
||||
var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})(?![_.\(A-Za-z0-9])/g;
|
||||
var a1_to_rc =(function(){
|
||||
return function a1_to_rc(fstr/*:string*/, base/*:CellAddress*/) {
|
||||
return fstr.replace(crefregex, function($0, $1, $2, $3, $4, $5) {
|
||||
@ -6004,7 +6015,7 @@ var browser_has_Map = typeof Map !== 'undefined';
|
||||
function get_sst_id(sst/*:SST*/, str/*:string*/, rev)/*:number*/ {
|
||||
var i = 0, len = sst.length;
|
||||
if(rev) {
|
||||
if(browser_has_Map ? rev.has(str) : rev.hasOwnProperty(str)) {
|
||||
if(browser_has_Map ? rev.has(str) : Object.prototype.hasOwnProperty.call(rev, str)) {
|
||||
var revarr = browser_has_Map ? rev.get(str) : rev[str];
|
||||
for(; i < revarr.length; ++i) {
|
||||
if(sst[revarr[i]].t === str) { sst.Count ++; return revarr[i]; }
|
||||
@ -6019,7 +6030,7 @@ function get_sst_id(sst/*:SST*/, str/*:string*/, rev)/*:number*/ {
|
||||
if(!rev.has(str)) rev.set(str, []);
|
||||
rev.get(str).push(len);
|
||||
} else {
|
||||
if(!rev.hasOwnProperty(str)) rev[str] = [];
|
||||
if(!Object.prototype.hasOwnProperty.call(rev, str)) rev[str] = [];
|
||||
rev[str].push(len);
|
||||
}
|
||||
}
|
||||
@ -7253,7 +7264,7 @@ function write_wb_xml(wb/*:Workbook*//*::, opts:?WriteOpts*/)/*:string*/ {
|
||||
if(n.Sheet != null) d.localSheetId = ""+n.Sheet;
|
||||
if(n.Hidden) d.hidden = "1";
|
||||
if(!n.Ref) return;
|
||||
o[o.length] = writextag('definedName', String(n.Ref).replace(/</g, "<").replace(/>/g, ">"), d);
|
||||
o[o.length] = writextag('definedName', escapexml(n.Ref), d);
|
||||
});
|
||||
o[o.length] = "</definedNames>";
|
||||
}
|
||||
@ -8071,7 +8082,7 @@ function readSync(data/*:RawData*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
|
||||
if(typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) return readSync(new Uint8Array(data), opts);
|
||||
var d = data, n = [0,0,0,0], str = false;
|
||||
var o = opts||{};
|
||||
if(o.cellStyles) { o.cellNF = true; }
|
||||
if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; }
|
||||
_ssfopts = {};
|
||||
if(o.dateNF) _ssfopts.dateNF = o.dateNF;
|
||||
if(!o.type) o.type = (has_buf && Buffer.isBuffer(data)) ? "buffer" : "base64";
|
||||
@ -8116,7 +8127,6 @@ function write_cfb_ctr(cfb/*:CFBContainer*/, o/*:WriteOpts*/)/*:any*/ {
|
||||
return CFB.write(cfb, o);
|
||||
}
|
||||
|
||||
/*global encrypt_agile */
|
||||
/*:: declare var encrypt_agile:any; */
|
||||
function write_zip_type(wb/*:Workbook*/, opts/*:?WriteOpts*/)/*:any*/ {
|
||||
var o = opts||{};
|
||||
@ -8133,7 +8143,9 @@ function write_zip_type(wb/*:Workbook*/, opts/*:?WriteOpts*/)/*:any*/ {
|
||||
default: throw new Error("Unrecognized type " + o.type);
|
||||
}
|
||||
var out = z.FullPaths ? CFB.write(z, {fileType:"zip", type: /*::(*/{"nodebuffer": "buffer", "string": "binary"}/*:: :any)*/[oopts.type] || oopts.type}) : z.generate(oopts);
|
||||
if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.password), o);
|
||||
/*jshint -W083 */
|
||||
if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.password), o); // eslint-disable-line no-undef
|
||||
/*jshint +W083 */
|
||||
if(o.type === "file") return write_dl(o.file, out);
|
||||
return o.type == "string" ? utf8read(/*::(*/out/*:: :any)*/) : out;
|
||||
}
|
||||
@ -8194,7 +8206,7 @@ function writeSync(wb/*:Workbook*/, opts/*:?WriteOpts*/) {
|
||||
reset_cp();
|
||||
check_wb(wb);
|
||||
var o = opts||{};
|
||||
if(o.cellStyles) { o.cellNF = true; }
|
||||
if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; }
|
||||
if(o.type == "array") { o.type = "binary"; var out/*:string*/ = (writeSync(wb, o)/*:any*/); o.type = "array"; return s2ab(out); }
|
||||
switch(o.bookType || 'xlsb') {
|
||||
case 'xml':
|
||||
@ -8264,7 +8276,7 @@ type MJRObject = {
|
||||
*/
|
||||
function make_json_row(sheet/*:Worksheet*/, r/*:Range*/, R/*:number*/, cols/*:Array<string>*/, header/*:number*/, hdr/*:Array<any>*/, dense/*:boolean*/, o/*:Sheet2JSONOpts*/)/*:MJRObject*/ {
|
||||
var rr = encode_row(R);
|
||||
var defval = o.defval, raw = o.raw || !o.hasOwnProperty("raw");
|
||||
var defval = o.defval, raw = o.raw || !Object.prototype.hasOwnProperty.call(o, "raw");
|
||||
var isempty = true;
|
||||
var row/*:any*/ = (header === 1) ? [] : {};
|
||||
if(header !== 1) {
|
||||
|
62
xlsx.mini.js
62
xlsx.mini.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.15.5';
|
||||
XLSX.version = '0.15.6';
|
||||
var current_codepage = 1200, current_ansi = 1252;
|
||||
|
||||
var VALID_ANSI = [ 874, 932, 936, 949, 950 ];
|
||||
@ -171,7 +171,7 @@ var chr0 = /\u0000/g, chr1 = /[\u0001-\u0006]/g;
|
||||
/*jshint -W041 */
|
||||
var SSF = ({});
|
||||
var make_ssf = function make_ssf(SSF){
|
||||
SSF.version = '0.10.2';
|
||||
SSF.version = '0.10.3';
|
||||
function _strrev(x) { var o = "", i = x.length-1; while(i>=0) o += x.charAt(i--); return o; }
|
||||
function fill(c,l) { var o = ""; while(o.length < l) o+=c; return o; }
|
||||
function pad0(v,d){var t=""+v; return t.length>=d?t:fill('0',d-t.length)+t;}
|
||||
@ -335,7 +335,7 @@ function general_fmt(v, opts) {
|
||||
switch(typeof v) {
|
||||
case 'string': return v;
|
||||
case 'boolean': return v ? "TRUE" : "FALSE";
|
||||
case 'number': return (v|0) === v ? general_fmt_int(v) : general_fmt_num(v);
|
||||
case 'number': return (v|0) === v ? v.toString(10) : general_fmt_num(v);
|
||||
case 'undefined': return "";
|
||||
case 'object':
|
||||
if(v == null) return "";
|
||||
@ -715,7 +715,7 @@ function fmt_is_date(fmt) {
|
||||
while(i < fmt.length) {
|
||||
switch((c = fmt.charAt(i))) {
|
||||
case 'G': if(isgeneral(fmt, i)) i+= 6; i++; break;
|
||||
case '"': for(;(/*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;) ++i; ++i; break;
|
||||
case '"': for(;(/*cc=*/fmt.charCodeAt(++i)) !== 34 && i < fmt.length;){/*empty*/} ++i; break;
|
||||
case '\\': i+=2; break;
|
||||
case '_': i+=2; break;
|
||||
case '@': ++i; break;
|
||||
@ -824,6 +824,7 @@ function eval_fmt(fmt, v, opts, flen) {
|
||||
o = c; while(i < fmt.length && "0123456789".indexOf(fmt.charAt(++i)) > -1) o+=fmt.charAt(i);
|
||||
out[out.length] = {t:'D', v:o}; break;
|
||||
case ' ': out[out.length] = {t:c, v:c}; ++i; break;
|
||||
case "$": out[out.length] = {t:'t', v:'$'}; ++i; break;
|
||||
default:
|
||||
if(",$-+/():!^&'~{}<>=€acfijklopqrtuvwxzP".indexOf(c) === -1) throw new Error('unrecognized character ' + c + ' in ' + fmt);
|
||||
out[out.length] = {t:'t', v:c}; ++i; break;
|
||||
@ -1122,7 +1123,7 @@ var DO_NOT_EXPORT_CFB = true;
|
||||
/* vim: set ts=2: */
|
||||
/*jshint eqnull:true */
|
||||
/*exported CFB */
|
||||
/*global module, require:false, process:false, Buffer:false, Uint8Array:false, Uint16Array:false */
|
||||
/*global Uint8Array:false, Uint16Array:false */
|
||||
|
||||
/* crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
@ -1228,7 +1229,7 @@ CRC32.str = crc32_str;
|
||||
/* [MS-CFB] v20171201 */
|
||||
var CFB = (function _CFB(){
|
||||
var exports = {};
|
||||
exports.version = '1.1.3';
|
||||
exports.version = '1.1.4';
|
||||
/* [MS-CFB] 2.6.4 */
|
||||
function namecmp(l, r) {
|
||||
var L = l.split("/"), R = r.split("/");
|
||||
@ -1559,7 +1560,9 @@ function make_sector_list(sectors, dir_start, fat_addrs, ssz) {
|
||||
k = (i + dir_start); if(k >= sl) k-=sl;
|
||||
if(chkd[k]) continue;
|
||||
buf_chain = [];
|
||||
var seen = [];
|
||||
for(j=k; j>=0;) {
|
||||
seen[j] = true;
|
||||
chkd[j] = true;
|
||||
buf[buf.length] = j;
|
||||
buf_chain.push(sectors[j]);
|
||||
@ -1568,6 +1571,7 @@ function make_sector_list(sectors, dir_start, fat_addrs, ssz) {
|
||||
if(ssz < 4 + jj) throw new Error("FAT boundary crossed: " + j + " 4 "+ssz);
|
||||
if(!sectors[addr]) break;
|
||||
j = __readInt32LE(sectors[addr], jj);
|
||||
if(seen[j]) break;
|
||||
}
|
||||
sector_list[k] = ({nodes: buf, data:__toBuffer([buf_chain])});
|
||||
}
|
||||
@ -2568,7 +2572,7 @@ function blobify(data) {
|
||||
}
|
||||
/* write or download file */
|
||||
function write_dl(fname, payload, enc) {
|
||||
/*global IE_SaveFile, Blob, navigator, saveAs, URL, document, File, chrome */
|
||||
/*global IE_SaveFile, Blob, navigator, saveAs, document, File, chrome */
|
||||
if(typeof _fs !== 'undefined' && _fs.writeFileSync) return enc ? _fs.writeFileSync(fname, payload, enc) : _fs.writeFileSync(fname, payload);
|
||||
var data = (enc == "utf8") ? utf8write(payload) : payload;
|
||||
if(typeof IE_SaveFile !== 'undefined') return IE_SaveFile(data, fname);
|
||||
@ -2615,7 +2619,7 @@ function read_binary(path) {
|
||||
}
|
||||
function keys(o) {
|
||||
var ks = Object.keys(o), o2 = [];
|
||||
for(var i = 0; i < ks.length; ++i) if(o.hasOwnProperty(ks[i])) o2.push(ks[i]);
|
||||
for(var i = 0; i < ks.length; ++i) if(Object.prototype.hasOwnProperty.call(o, ks[i])) o2.push(ks[i]);
|
||||
return o2;
|
||||
}
|
||||
|
||||
@ -2720,7 +2724,7 @@ function dup(o) {
|
||||
if(typeof o != 'object' || o == null) return o;
|
||||
if(o instanceof Date) return new Date(o.getTime());
|
||||
var out = {};
|
||||
for(var k in o) if(o.hasOwnProperty(k)) out[k] = dup(o[k]);
|
||||
for(var k in o) if(Object.prototype.hasOwnProperty.call(o, k)) out[k] = dup(o[k]);
|
||||
return out;
|
||||
}
|
||||
|
||||
@ -2899,7 +2903,7 @@ var rencoding = evert(encodings);
|
||||
// TODO: CP remap (need to read file version to determine OS)
|
||||
var unescapexml = (function() {
|
||||
/* 22.4.2.4 bstr (Basic String) */
|
||||
var encregex = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/g, coderegex = /_x([\da-fA-F]{4})_/g;
|
||||
var encregex = /&(?:quot|apos|gt|lt|amp|#x?([\da-fA-F]+));/ig, coderegex = /_x([\da-fA-F]{4})_/ig;
|
||||
return function unescapexml(text) {
|
||||
var s = text + '', i = s.indexOf("<![CDATA[");
|
||||
if(i == -1) return s.replace(encregex, function($$, $1) { return encodings[$$]||String.fromCharCode(parseInt($1,$$.indexOf("x")>-1?16:10))||$$; }).replace(coderegex,function(m,c) {return String.fromCharCode(parseInt(c,16));});
|
||||
@ -3026,7 +3030,7 @@ var htmldecode = (function() {
|
||||
var entities = [
|
||||
['nbsp', ' '], ['middot', '·'],
|
||||
['quot', '"'], ['apos', "'"], ['gt', '>'], ['lt', '<'], ['amp', '&']
|
||||
].map(function(x) { return [new RegExp('&' + x[0] + ';', "g"), x[1]]; });
|
||||
].map(function(x) { return [new RegExp('&' + x[0] + ';', "ig"), x[1]]; });
|
||||
return function htmldecode(str) {
|
||||
var o = str
|
||||
// Remove new lines and spaces from start of content
|
||||
@ -3461,7 +3465,7 @@ function encode_range_xls(r, opts) {
|
||||
}
|
||||
}
|
||||
if(r.s.c == 0 && !r.s.cRel) {
|
||||
if(r.e.c == (opts.biff >= 12 ? 0xFFFF : 0xFF) && !r.e.cRel) {
|
||||
if(r.e.c == (opts.biff >= 12 ? 0x3FFF : 0xFF) && !r.e.cRel) {
|
||||
return (r.s.rRel ? "" : "$") + encode_row(r.s.r) + ":" + (r.e.rRel ? "" : "$") + encode_row(r.e.r);
|
||||
}
|
||||
}
|
||||
@ -3707,7 +3711,7 @@ var SpecialProperties = {
|
||||
};
|
||||
|
||||
(function() {
|
||||
for(var y in SpecialProperties) if(SpecialProperties.hasOwnProperty(y))
|
||||
for(var y in SpecialProperties) if(Object.prototype.hasOwnProperty.call(SpecialProperties, y))
|
||||
DocSummaryPIDDSI[y] = SummaryPIDSI[y] = SpecialProperties[y];
|
||||
})();
|
||||
|
||||
@ -5047,7 +5051,7 @@ function parse_fonts(t, styles, themes, opts) {
|
||||
break;
|
||||
|
||||
/* 18.8.29 name CT_FontName */
|
||||
case '<name': if(y.val) font.name = y.val; break;
|
||||
case '<name': if(y.val) font.name = utf8read(y.val); break;
|
||||
case '<name/>': case '</name>': break;
|
||||
|
||||
/* 18.8.2 b CT_BooleanProperty */
|
||||
@ -5286,11 +5290,11 @@ return function parse_sty_xml(data, themes, opts) {
|
||||
if((t=data.match(bordersRegex))) parse_borders(t, styles, themes, opts);
|
||||
|
||||
/* 18.8.9 cellStyleXfs CT_CellStyleXfs ? */
|
||||
/* 18.8.8 cellStyles CT_CellStyles ? */
|
||||
|
||||
/* 18.8.10 cellXfs CT_CellXfs ? */
|
||||
if((t=data.match(cellXfRegex))) parse_cellXfs(t, styles, opts);
|
||||
|
||||
/* 18.8.8 cellStyles CT_CellStyles ? */
|
||||
/* 18.8.15 dxfs CT_Dxfs ? */
|
||||
/* 18.8.42 tableStyles CT_TableStyles ? */
|
||||
/* 18.8.11 colors CT_Colors ? */
|
||||
@ -5324,6 +5328,13 @@ function write_sty_xml(wb, opts) {
|
||||
}
|
||||
RELS.THEME = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";
|
||||
|
||||
/* Even though theme layout is dk1 lt1 dk2 lt2, true order is lt1 dk1 lt2 dk2 */
|
||||
var XLSXThemeClrScheme = [
|
||||
'</a:lt1>', '</a:dk1>', '</a:lt2>', '</a:dk2>',
|
||||
'</a:accent1>', '</a:accent2>', '</a:accent3>',
|
||||
'</a:accent4>', '</a:accent5>', '</a:accent6>',
|
||||
'</a:hlink>', '</a:folHlink>'
|
||||
];
|
||||
/* 20.1.6.2 clrScheme CT_ColorScheme */
|
||||
function parse_clrScheme(t, themes, opts) {
|
||||
themes.themeElements.clrScheme = [];
|
||||
@ -5367,7 +5378,7 @@ function parse_clrScheme(t, themes, opts) {
|
||||
case '<a:hlink>': case '</a:hlink>':
|
||||
case '<a:folHlink>': case '</a:folHlink>':
|
||||
if (y[0].charAt(1) === '/') {
|
||||
themes.themeElements.clrScheme.push(color);
|
||||
themes.themeElements.clrScheme[XLSXThemeClrScheme.indexOf(y[0])] = color;
|
||||
color = {};
|
||||
} else {
|
||||
color.name = y[0].slice(3, y[0].length - 1);
|
||||
@ -5865,7 +5876,7 @@ var rc_to_a1 = (function(){
|
||||
};
|
||||
})();
|
||||
|
||||
var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)([1-9]\d{0,5}|10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6])(?![_.\(A-Za-z0-9])/g;
|
||||
var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)(10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6]|[1-9]\d{0,5})(?![_.\(A-Za-z0-9])/g;
|
||||
var a1_to_rc =(function(){
|
||||
return function a1_to_rc(fstr, base) {
|
||||
return fstr.replace(crefregex, function($0, $1, $2, $3, $4, $5) {
|
||||
@ -5914,7 +5925,7 @@ var browser_has_Map = typeof Map !== 'undefined';
|
||||
function get_sst_id(sst, str, rev) {
|
||||
var i = 0, len = sst.length;
|
||||
if(rev) {
|
||||
if(browser_has_Map ? rev.has(str) : rev.hasOwnProperty(str)) {
|
||||
if(browser_has_Map ? rev.has(str) : Object.prototype.hasOwnProperty.call(rev, str)) {
|
||||
var revarr = browser_has_Map ? rev.get(str) : rev[str];
|
||||
for(; i < revarr.length; ++i) {
|
||||
if(sst[revarr[i]].t === str) { sst.Count ++; return revarr[i]; }
|
||||
@ -5929,7 +5940,7 @@ function get_sst_id(sst, str, rev) {
|
||||
if(!rev.has(str)) rev.set(str, []);
|
||||
rev.get(str).push(len);
|
||||
} else {
|
||||
if(!rev.hasOwnProperty(str)) rev[str] = [];
|
||||
if(!Object.prototype.hasOwnProperty.call(rev, str)) rev[str] = [];
|
||||
rev[str].push(len);
|
||||
}
|
||||
}
|
||||
@ -7161,7 +7172,7 @@ if(wb.Workbook.WBProps.CodeName) { workbookPr.codeName = wb.Workbook.WBProps.Cod
|
||||
if(n.Sheet != null) d.localSheetId = ""+n.Sheet;
|
||||
if(n.Hidden) d.hidden = "1";
|
||||
if(!n.Ref) return;
|
||||
o[o.length] = writextag('definedName', String(n.Ref).replace(/</g, "<").replace(/>/g, ">"), d);
|
||||
o[o.length] = writextag('definedName', escapexml(n.Ref), d);
|
||||
});
|
||||
o[o.length] = "</definedNames>";
|
||||
}
|
||||
@ -7974,7 +7985,7 @@ function readSync(data, opts) {
|
||||
if(typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) return readSync(new Uint8Array(data), opts);
|
||||
var d = data, n = [0,0,0,0], str = false;
|
||||
var o = opts||{};
|
||||
if(o.cellStyles) { o.cellNF = true; }
|
||||
if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; }
|
||||
_ssfopts = {};
|
||||
if(o.dateNF) _ssfopts.dateNF = o.dateNF;
|
||||
if(!o.type) o.type = (has_buf && Buffer.isBuffer(data)) ? "buffer" : "base64";
|
||||
@ -8019,7 +8030,6 @@ function write_cfb_ctr(cfb, o) {
|
||||
return CFB.write(cfb, o);
|
||||
}
|
||||
|
||||
/*global encrypt_agile */
|
||||
function write_zip_type(wb, opts) {
|
||||
var o = opts||{};
|
||||
var z = write_zip(wb, o);
|
||||
@ -8035,7 +8045,9 @@ function write_zip_type(wb, opts) {
|
||||
default: throw new Error("Unrecognized type " + o.type);
|
||||
}
|
||||
var out = z.FullPaths ? CFB.write(z, {fileType:"zip", type: {"nodebuffer": "buffer", "string": "binary"}[oopts.type] || oopts.type}) : z.generate(oopts);
|
||||
if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.password), o);
|
||||
/*jshint -W083 */
|
||||
if(o.password && typeof encrypt_agile !== 'undefined') return write_cfb_ctr(encrypt_agile(out, o.password), o); // eslint-disable-line no-undef
|
||||
/*jshint +W083 */
|
||||
if(o.type === "file") return write_dl(o.file, out);
|
||||
return o.type == "string" ? utf8read(out) : out;
|
||||
}
|
||||
@ -8096,7 +8108,7 @@ function writeSync(wb, opts) {
|
||||
reset_cp();
|
||||
check_wb(wb);
|
||||
var o = opts||{};
|
||||
if(o.cellStyles) { o.cellNF = true; }
|
||||
if(o.cellStyles) { o.cellNF = true; o.sheetStubs = true; }
|
||||
if(o.type == "array") { o.type = "binary"; var out = (writeSync(wb, o)); o.type = "array"; return s2ab(out); }
|
||||
switch(o.bookType || 'xlsb') {
|
||||
case 'xml':
|
||||
@ -8160,7 +8172,7 @@ function writeFileAsync(filename, wb, opts, cb) {
|
||||
}
|
||||
function make_json_row(sheet, r, R, cols, header, hdr, dense, o) {
|
||||
var rr = encode_row(R);
|
||||
var defval = o.defval, raw = o.raw || !o.hasOwnProperty("raw");
|
||||
var defval = o.defval, raw = o.raw || !Object.prototype.hasOwnProperty.call(o, "raw");
|
||||
var isempty = true;
|
||||
var row = (header === 1) ? [] : {};
|
||||
if(header !== 1) {
|
||||
|
Loading…
Reference in New Issue
Block a user