2015-04-02 20:32:22 +00:00
|
|
|
/* [MS-OLEDS] 2.3.8 CompObjStream */
|
2017-09-30 06:18:11 +00:00
|
|
|
function parse_compobj(obj/*:CFBEntry*/) {
|
2015-04-02 20:32:22 +00:00
|
|
|
var v = {};
|
|
|
|
var o = obj.content;
|
2017-09-30 06:18:11 +00:00
|
|
|
/*:: if(o == null) return; */
|
2015-04-02 20:32:22 +00:00
|
|
|
|
|
|
|
/* [MS-OLEDS] 2.3.7 CompObjHeader -- All fields MUST be ignored */
|
2017-12-30 05:40:35 +00:00
|
|
|
o.l = 28;
|
|
|
|
|
|
|
|
v.AnsiUserType = o.read_shift(0, "lpstr-ansi");
|
|
|
|
v.AnsiClipboardFormat = parse_ClipboardFormatOrAnsiString(o);
|
|
|
|
|
|
|
|
if(o.length - o.l <= 4) return v;
|
|
|
|
|
|
|
|
var m/*:number*/ = o.read_shift(4);
|
|
|
|
if(m == 0 || m > 40) return v;
|
|
|
|
o.l-=4; v.Reserved1 = o.read_shift(0, "lpstr-ansi");
|
2015-04-02 20:32:22 +00:00
|
|
|
|
2017-12-30 05:40:35 +00:00
|
|
|
if(o.length - o.l <= 4) return v;
|
|
|
|
m = o.read_shift(4);
|
|
|
|
if(m !== 0x71b239f4) return v;
|
|
|
|
v.UnicodeClipboardFormat = parse_ClipboardFormatOrUnicodeString(o);
|
2015-04-02 20:32:22 +00:00
|
|
|
|
2017-12-30 05:40:35 +00:00
|
|
|
m = o.read_shift(4);
|
|
|
|
if(m == 0 || m > 40) return v;
|
|
|
|
o.l-=4; v.Reserved2 = o.read_shift(0, "lpwstr");
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
|
|
|
|
2017-07-26 08:35:28 +00:00
|
|
|
/*
|
|
|
|
Continue logic for:
|
2022-03-12 14:05:57 +00:00
|
|
|
- 2.4.58 Continue 0x003c
|
|
|
|
- 2.4.59 ContinueBigName 0x043c
|
|
|
|
- 2.4.60 ContinueFrt 0x0812
|
|
|
|
- 2.4.61 ContinueFrt11 0x0875
|
|
|
|
- 2.4.62 ContinueFrt12 0x087f
|
2017-07-26 08:35:28 +00:00
|
|
|
*/
|
2022-03-12 14:05:57 +00:00
|
|
|
var CONTINUE_RT = [ 0x003c, 0x043c, 0x0812, 0x0875, 0x087f ];
|
|
|
|
function slurp(RecordType, R, blob, length/*:number*/, opts)/*:any*/ {
|
2015-04-02 20:32:22 +00:00
|
|
|
var l = length;
|
|
|
|
var bufs = [];
|
|
|
|
var d = blob.slice(blob.l,blob.l+l);
|
2022-03-12 14:05:57 +00:00
|
|
|
if(opts && opts.enc && opts.enc.insitu && d.length > 0) switch(RecordType) {
|
2022-05-22 23:51:41 +00:00
|
|
|
case 0x0009: case 0x0209: case 0x0409: case 0x0809/* BOF */: case 0x002F /* FilePass */: case 0x0195 /* FileLock */: case 0x00E1 /* InterfaceHdr */: case 0x0196 /* RRDInfo */: case 0x0138 /* RRDHead */: case 0x0194 /* UsrExcl */: case 0x000a /* EOF */:
|
2021-05-13 19:02:31 +00:00
|
|
|
break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x0085 /* BoundSheet8 */:
|
2021-05-13 19:02:31 +00:00
|
|
|
break;
|
2015-04-02 20:32:22 +00:00
|
|
|
default:
|
2017-10-17 00:14:32 +00:00
|
|
|
opts.enc.insitu(d);
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
|
|
|
bufs.push(d);
|
|
|
|
blob.l += l;
|
2022-03-12 14:05:57 +00:00
|
|
|
var nextrt = __readUInt16LE(blob,blob.l), next = XLSRecordEnum[nextrt];
|
2017-07-26 08:35:28 +00:00
|
|
|
var start = 0;
|
2022-03-12 14:05:57 +00:00
|
|
|
while(next != null && CONTINUE_RT.indexOf(nextrt) > -1) {
|
2015-04-02 20:32:22 +00:00
|
|
|
l = __readUInt16LE(blob,blob.l+2);
|
2017-07-26 08:35:28 +00:00
|
|
|
start = blob.l + 4;
|
2022-03-12 14:05:57 +00:00
|
|
|
if(nextrt == 0x0812 /* ContinueFrt */) start += 4;
|
|
|
|
else if(nextrt == 0x0875 || nextrt == 0x087f) {
|
2021-05-13 19:02:31 +00:00
|
|
|
start += 12;
|
|
|
|
}
|
|
|
|
d = blob.slice(start,blob.l+4+l);
|
|
|
|
bufs.push(d);
|
2015-04-02 20:32:22 +00:00
|
|
|
blob.l += 4+l;
|
2022-03-12 14:05:57 +00:00
|
|
|
next = (XLSRecordEnum[nextrt = __readUInt16LE(blob, blob.l)]);
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
2017-02-10 19:23:01 +00:00
|
|
|
var b = (bconcat(bufs)/*:any*/);
|
2015-04-02 20:32:22 +00:00
|
|
|
prep_blob(b, 0);
|
|
|
|
var ll = 0; b.lens = [];
|
|
|
|
for(var j = 0; j < bufs.length; ++j) { b.lens.push(ll); ll += bufs[j].length; }
|
2022-03-12 14:05:57 +00:00
|
|
|
if(b.length < length) throw "XLS Record 0x" + RecordType.toString(16) + " Truncated: " + b.length + " < " + length;
|
2015-04-02 20:32:22 +00:00
|
|
|
return R.f(b, b.length, opts);
|
|
|
|
}
|
|
|
|
|
2017-03-12 18:02:43 +00:00
|
|
|
function safe_format_xf(p/*:any*/, opts/*:ParseOpts*/, date1904/*:?boolean*/) {
|
2017-03-15 08:19:02 +00:00
|
|
|
if(p.t === 'z') return;
|
2015-04-02 20:32:22 +00:00
|
|
|
if(!p.XF) return;
|
2017-05-13 18:21:22 +00:00
|
|
|
var fmtid = 0;
|
2015-04-02 20:32:22 +00:00
|
|
|
try {
|
2017-07-27 20:07:51 +00:00
|
|
|
fmtid = p.z || p.XF.numFmtId || 0;
|
2023-06-23 09:48:47 +00:00
|
|
|
if(opts.cellNF && p.z == null) p.z = table_fmt[fmtid];
|
2017-04-26 02:27:12 +00:00
|
|
|
} catch(e) { if(opts.WTF) throw e; }
|
|
|
|
if(!opts || opts.cellText !== false) try {
|
|
|
|
if(p.t === 'e') { p.w = p.w || BErr[p.v]; }
|
2017-07-27 20:07:51 +00:00
|
|
|
else if(fmtid === 0 || fmtid == "General") {
|
2015-04-02 20:32:22 +00:00
|
|
|
if(p.t === 'n') {
|
2022-03-17 04:38:06 +00:00
|
|
|
if((p.v|0) === p.v) p.w = p.v.toString(10);
|
2022-03-20 01:54:41 +00:00
|
|
|
else p.w = SSF_general_num(p.v);
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
2022-03-20 01:54:41 +00:00
|
|
|
else p.w = SSF_general(p.v);
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
2022-03-20 01:54:41 +00:00
|
|
|
else p.w = SSF_format(fmtid,p.v, {date1904:!!date1904, dateNF: opts && opts.dateNF});
|
2015-04-02 20:32:22 +00:00
|
|
|
} catch(e) { if(opts.WTF) throw e; }
|
2022-03-20 01:54:41 +00:00
|
|
|
if(opts.cellDates && fmtid && p.t == 'n' && fmt_is_date(table_fmt[fmtid] || String(fmtid))) {
|
2023-06-23 09:48:47 +00:00
|
|
|
var _d = SSF_parse_date_code(p.v + (date1904 ? 1462 : 0)); if(_d) { p.t = 'd'; p.v = new Date(Date.UTC(_d.y, _d.m-1,_d.d,_d.H,_d.M,_d.S,_d.u)); }
|
2017-10-18 03:05:05 +00:00
|
|
|
}
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
|
|
|
|
2017-05-13 18:21:22 +00:00
|
|
|
function make_cell(val, ixfe, t)/*:Cell*/ {
|
2017-02-10 19:23:01 +00:00
|
|
|
return ({v:val, ixfe:ixfe, t:t}/*:any*/);
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 2.3.2
|
2017-02-10 19:23:01 +00:00
|
|
|
function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
|
|
|
var wb = ({opts:{}}/*:any*/);
|
2015-04-02 20:32:22 +00:00
|
|
|
var Sheets = {};
|
2017-04-09 04:03:19 +00:00
|
|
|
if(DENSE != null && options.dense == null) options.dense = DENSE;
|
2022-10-24 01:05:59 +00:00
|
|
|
var out/*:Worksheet*/ = ({}/*:any*/); if(options.dense) out["!data"] = [];
|
2015-04-02 20:32:22 +00:00
|
|
|
var Directory = {};
|
2017-03-25 01:36:40 +00:00
|
|
|
var range/*:Range*/ = ({}/*:any*/);
|
2015-04-02 20:32:22 +00:00
|
|
|
var last_formula = null;
|
2017-12-30 05:40:35 +00:00
|
|
|
var sst/*:SST*/ = ([]/*:any*/);
|
2015-04-02 20:32:22 +00:00
|
|
|
var cur_sheet = "";
|
|
|
|
var Preamble = {};
|
2019-11-01 03:09:14 +00:00
|
|
|
var lastcell, last_cell = "", cc/*:Cell*/, cmnt, rngC, rngR;
|
2018-01-09 07:36:02 +00:00
|
|
|
var sharedf = {};
|
2017-12-30 05:40:35 +00:00
|
|
|
var arrayf/*:Array<[Range, string]>*/ = [];
|
2017-05-13 18:21:22 +00:00
|
|
|
var temp_val/*:Cell*/;
|
2015-04-02 20:32:22 +00:00
|
|
|
var country;
|
|
|
|
var XFs = []; /* XF records */
|
2019-11-01 03:09:14 +00:00
|
|
|
var palette/*:Array<[number, number, number]>*/ = [];
|
2017-12-30 05:40:35 +00:00
|
|
|
var Workbook/*:WBWBProps*/ = ({ Sheets:[], WBProps:{date1904:false}, Views:[{}] }/*:any*/), wsprops = {};
|
2023-06-23 09:48:47 +00:00
|
|
|
var biff4w = false;
|
2019-11-01 03:09:14 +00:00
|
|
|
var get_rgb = function getrgb(icv/*:number*/)/*:[number, number, number]*/ {
|
2015-04-02 20:32:22 +00:00
|
|
|
if(icv < 8) return XLSIcv[icv];
|
|
|
|
if(icv < 64) return palette[icv-8] || XLSIcv[icv];
|
|
|
|
return XLSIcv[icv];
|
|
|
|
};
|
2024-01-10 09:54:10 +00:00
|
|
|
var process_cell_style = function pcs(line/*:any*/, options) {
|
2015-04-02 20:32:22 +00:00
|
|
|
var xfd = line.XF.data;
|
2017-03-20 09:02:25 +00:00
|
|
|
if(!xfd || !xfd.patternType || !options || !options.cellStyles) return;
|
2017-03-12 18:02:43 +00:00
|
|
|
line.s = ({}/*:any*/);
|
2015-04-02 20:32:22 +00:00
|
|
|
line.s.patternType = xfd.patternType;
|
|
|
|
var t;
|
|
|
|
if((t = rgb2Hex(get_rgb(xfd.icvFore)))) { line.s.fgColor = {rgb:t}; }
|
|
|
|
if((t = rgb2Hex(get_rgb(xfd.icvBack)))) { line.s.bgColor = {rgb:t}; }
|
|
|
|
};
|
2017-03-12 18:02:43 +00:00
|
|
|
var addcell = function addcell(cell/*:any*/, line/*:any*/, options/*:any*/) {
|
2023-06-23 09:48:47 +00:00
|
|
|
if(!biff4w && file_depth > 1) return;
|
2021-10-27 06:26:17 +00:00
|
|
|
if(options.sheetRows && cell.r >= options.sheetRows) return;
|
2024-01-10 09:54:10 +00:00
|
|
|
if(options.cellStyles && line.XF && line.XF.data) process_cell_style(line, options);
|
2017-08-18 18:10:18 +00:00
|
|
|
delete line.ixfe; delete line.XF;
|
2015-04-02 20:32:22 +00:00
|
|
|
lastcell = cell;
|
|
|
|
last_cell = encode_cell(cell);
|
2018-11-13 20:25:51 +00:00
|
|
|
if(!range || !range.s || !range.e) range = {s:{r:0,c:0},e:{r:0,c:0}};
|
|
|
|
if(cell.r < range.s.r) range.s.r = cell.r;
|
|
|
|
if(cell.c < range.s.c) range.s.c = cell.c;
|
|
|
|
if(cell.r + 1 > range.e.r) range.e.r = cell.r + 1;
|
|
|
|
if(cell.c + 1 > range.e.c) range.e.c = cell.c + 1;
|
2017-03-18 00:45:06 +00:00
|
|
|
if(options.cellFormula && line.f) {
|
2017-12-30 05:40:35 +00:00
|
|
|
for(var afi = 0; afi < arrayf.length; ++afi) {
|
2018-01-09 07:36:02 +00:00
|
|
|
if(arrayf[afi][0].s.c > cell.c || arrayf[afi][0].s.r > cell.r) continue;
|
|
|
|
if(arrayf[afi][0].e.c < cell.c || arrayf[afi][0].e.r < cell.r) continue;
|
2017-12-30 05:40:35 +00:00
|
|
|
line.F = encode_range(arrayf[afi][0]);
|
2018-01-09 07:36:02 +00:00
|
|
|
if(arrayf[afi][0].s.c != cell.c || arrayf[afi][0].s.r != cell.r) delete line.f;
|
2017-12-30 05:40:35 +00:00
|
|
|
if(line.f) line.f = "" + stringify_formula(arrayf[afi][1], range, cell, supbooks, opts);
|
2017-03-18 00:45:06 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2018-04-06 06:39:48 +00:00
|
|
|
{
|
2017-04-08 06:55:35 +00:00
|
|
|
if(options.dense) {
|
2022-10-24 01:05:59 +00:00
|
|
|
if(!out["!data"][cell.r]) out["!data"][cell.r] = [];
|
|
|
|
out["!data"][cell.r][cell.c] = line;
|
2017-04-08 06:55:35 +00:00
|
|
|
} else out[last_cell] = line;
|
|
|
|
}
|
2015-04-02 20:32:22 +00:00
|
|
|
};
|
2017-02-10 19:23:01 +00:00
|
|
|
var opts = ({
|
2015-04-02 20:32:22 +00:00
|
|
|
enc: false, // encrypted
|
|
|
|
sbcch: 0, // cch in the preceding SupBook
|
|
|
|
snames: [], // sheetnames
|
2018-01-09 07:36:02 +00:00
|
|
|
sharedf: sharedf, // shared formulae by address
|
2017-12-30 05:40:35 +00:00
|
|
|
arrayf: arrayf, // array formulae array
|
2015-04-02 20:32:22 +00:00
|
|
|
rrtabid: [], // RRTabId
|
|
|
|
lastuser: "", // Last User from WriteAccess
|
|
|
|
biff: 8, // BIFF version
|
|
|
|
codepage: 0, // CP from CodePage record
|
|
|
|
winlocked: 0, // fLockWn from WinProtect
|
2017-03-20 09:02:25 +00:00
|
|
|
cellStyles: !!options && !!options.cellStyles,
|
2017-03-18 23:25:50 +00:00
|
|
|
WTF: !!options && !!options.wtf
|
2017-02-10 19:23:01 +00:00
|
|
|
}/*:any*/);
|
2015-04-02 20:32:22 +00:00
|
|
|
if(options.password) opts.password = options.password;
|
2017-12-30 05:40:35 +00:00
|
|
|
var themes;
|
|
|
|
var merges/*:Array<Range>*/ = [];
|
2015-04-02 20:32:22 +00:00
|
|
|
var objects = [];
|
2017-12-30 05:40:35 +00:00
|
|
|
var colinfo/*:Array<ColInfo>*/ = [], rowinfo/*:Array<RowInfo>*/ = [];
|
2017-03-20 09:02:25 +00:00
|
|
|
var seencol = false;
|
2017-04-11 22:15:36 +00:00
|
|
|
var supbooks = ([]/*:any*/); // 1-indexed, will hold extern names
|
2015-04-02 20:32:22 +00:00
|
|
|
supbooks.SheetNames = opts.snames;
|
|
|
|
supbooks.sharedf = opts.sharedf;
|
|
|
|
supbooks.arrayf = opts.arrayf;
|
2017-04-11 22:15:36 +00:00
|
|
|
supbooks.names = [];
|
|
|
|
supbooks.XTI = [];
|
2022-03-12 14:05:57 +00:00
|
|
|
var last_RT = 0;
|
2015-04-02 20:32:22 +00:00
|
|
|
var file_depth = 0; /* TODO: make a real stack */
|
2017-12-30 05:40:35 +00:00
|
|
|
var BIFF2Fmt = 0, BIFF2FmtTable/*:Array<string>*/ = [];
|
2017-04-10 05:10:54 +00:00
|
|
|
var FilterDatabases = []; /* TODO: sort out supbooks and process elsewhere */
|
2017-05-13 18:21:22 +00:00
|
|
|
var last_lbl/*:?DefinedName*/;
|
2015-04-02 20:32:22 +00:00
|
|
|
|
|
|
|
/* explicit override for some broken writers */
|
|
|
|
opts.codepage = 1200;
|
|
|
|
set_cp(1200);
|
2017-12-09 07:17:25 +00:00
|
|
|
var seen_codepage = false;
|
2015-04-02 20:32:22 +00:00
|
|
|
while(blob.l < blob.length - 1) {
|
|
|
|
var s = blob.l;
|
|
|
|
var RecordType = blob.read_shift(2);
|
2022-03-12 14:05:57 +00:00
|
|
|
if(RecordType === 0 && last_RT === 0x000a /* EOF */) break;
|
2018-01-23 09:07:51 +00:00
|
|
|
var length = (blob.l === blob.length ? 0 : blob.read_shift(2));
|
2015-04-02 20:32:22 +00:00
|
|
|
var R = XLSRecordEnum[RecordType];
|
2022-08-08 18:23:27 +00:00
|
|
|
if(file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(RecordType) == -1 /* BOF */) break;
|
2017-02-10 19:23:01 +00:00
|
|
|
//console.log(RecordType.toString(16), RecordType, R, blob.l, length, blob.length);
|
2017-03-05 00:56:31 +00:00
|
|
|
//if(!R) console.log(blob.slice(blob.l, blob.l + length));
|
2015-04-02 20:32:22 +00:00
|
|
|
if(R && R.f) {
|
|
|
|
if(options.bookSheets) {
|
2022-03-12 14:05:57 +00:00
|
|
|
if(last_RT === 0x0085 /* BoundSheet8 */ && RecordType !== 0x0085 /* R.n !== 'BoundSheet8' */) break;
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
2022-03-12 14:05:57 +00:00
|
|
|
last_RT = RecordType;
|
2015-04-02 20:32:22 +00:00
|
|
|
if(R.r === 2 || R.r == 12) {
|
|
|
|
var rt = blob.read_shift(2); length -= 2;
|
2018-02-21 07:01:34 +00:00
|
|
|
if(!opts.enc && rt !== RecordType && (((rt&0xFF)<<8)|(rt>>8)) !== RecordType) throw new Error("rt mismatch: " + rt + "!=" + RecordType);
|
2021-09-26 22:51:19 +00:00
|
|
|
if(R.r == 12){
|
|
|
|
blob.l += 10; length -= 10;
|
|
|
|
} // skip FRT
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
|
|
|
//console.error(R,blob.l,length,blob.length);
|
2019-11-01 03:09:14 +00:00
|
|
|
var val/*:any*/ = ({}/*:any*/);
|
2022-03-12 14:05:57 +00:00
|
|
|
if(RecordType === 0x000a /* EOF */) val = /*::(*/R.f(blob, length, opts)/*:: :any)*/;
|
|
|
|
else val = /*::(*/slurp(RecordType, R, blob, length, opts)/*:: :any)*/;
|
2019-11-01 03:09:14 +00:00
|
|
|
/*:: val = (val:any); */
|
2022-05-22 23:51:41 +00:00
|
|
|
if(file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(last_RT) === -1 /* BOF */) continue;
|
2022-03-12 14:05:57 +00:00
|
|
|
switch(RecordType) {
|
|
|
|
case 0x0022 /* Date1904 */:
|
2017-06-01 21:22:11 +00:00
|
|
|
/*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */
|
|
|
|
wb.opts.Date1904 = Workbook.WBProps.date1904 = val; break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x0086 /* WriteProtect */: wb.opts.WriteProtect = true; break;
|
|
|
|
case 0x002f /* FilePass */:
|
2015-04-02 20:32:22 +00:00
|
|
|
if(!opts.enc) blob.l = 0;
|
|
|
|
opts.enc = val;
|
|
|
|
if(!options.password) throw new Error("File is password-protected");
|
2017-05-11 07:29:59 +00:00
|
|
|
if(val.valid == null) throw new Error("Encryption scheme unsupported");
|
2015-04-02 20:32:22 +00:00
|
|
|
if(!val.valid) throw new Error("Password is incorrect");
|
|
|
|
break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x005c /* WriteAccess */: opts.lastuser = val; break;
|
|
|
|
case 0x0042 /* CodePage */:
|
2019-11-01 03:09:14 +00:00
|
|
|
var cpval = Number(val);
|
2015-04-02 20:32:22 +00:00
|
|
|
/* overrides based on test cases */
|
2019-11-01 03:09:14 +00:00
|
|
|
switch(cpval) {
|
|
|
|
case 0x5212: cpval = 1200; break;
|
|
|
|
case 0x8000: cpval = 10000; break;
|
|
|
|
case 0x8001: cpval = 1252; break;
|
2017-08-18 18:10:18 +00:00
|
|
|
}
|
2019-11-01 03:09:14 +00:00
|
|
|
set_cp(opts.codepage = cpval);
|
2017-12-09 07:17:25 +00:00
|
|
|
seen_codepage = true;
|
2015-04-02 20:32:22 +00:00
|
|
|
break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x013d /* RRTabId */: opts.rrtabid = val; break;
|
|
|
|
case 0x0019 /* WinProtect */: opts.winlocked = val; break;
|
|
|
|
case 0x01b7 /* RefreshAll */: wb.opts["RefreshAll"] = val; break;
|
|
|
|
case 0x000c /* CalcCount */: wb.opts["CalcCount"] = val; break;
|
|
|
|
case 0x0010 /* CalcDelta */: wb.opts["CalcDelta"] = val; break;
|
|
|
|
case 0x0011 /* CalcIter */: wb.opts["CalcIter"] = val; break;
|
|
|
|
case 0x000d /* CalcMode */: wb.opts["CalcMode"] = val; break;
|
|
|
|
case 0x000e /* CalcPrecision */: wb.opts["CalcPrecision"] = val; break;
|
|
|
|
case 0x005f /* CalcSaveRecalc */: wb.opts["CalcSaveRecalc"] = val; break;
|
|
|
|
case 0x000f /* CalcRefMode */: opts.CalcRefMode = val; break; // TODO: implement R1C1
|
|
|
|
case 0x08a3 /* ForceFullCalculation */: wb.opts.FullCalc = val; break;
|
|
|
|
case 0x0081 /* WsBool */:
|
2017-11-20 01:51:14 +00:00
|
|
|
if(val.fDialog) out["!type"] = "dialog";
|
2021-09-22 06:45:08 +00:00
|
|
|
if(!val.fBelow) (out["!outline"] || (out["!outline"] = {})).above = true;
|
|
|
|
if(!val.fRight) (out["!outline"] || (out["!outline"] = {})).left = true;
|
2017-11-20 01:51:14 +00:00
|
|
|
break; // TODO
|
2023-06-23 09:48:47 +00:00
|
|
|
case 0x0043: /* BIFF2XF */ case 0x0243: /* BIFF3XF */ case 0x0443: /* BIFF4XF */
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x00e0 /* XF */:
|
2019-04-01 14:25:15 +00:00
|
|
|
XFs.push(val); break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x01ae /* SupBook */:
|
2017-04-11 22:15:36 +00:00
|
|
|
supbooks.push([val]);
|
|
|
|
supbooks[supbooks.length-1].XTI = [];
|
|
|
|
break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x0023: case 0x0223 /* ExternName */:
|
2017-04-11 22:15:36 +00:00
|
|
|
supbooks[supbooks.length-1].push(val);
|
|
|
|
break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x0018: case 0x0218 /* Lbl */:
|
2017-05-13 18:21:22 +00:00
|
|
|
last_lbl = ({
|
2017-04-11 22:15:36 +00:00
|
|
|
Name: val.Name,
|
|
|
|
Ref: stringify_formula(val.rgce,range,null,supbooks,opts)
|
2017-05-13 18:21:22 +00:00
|
|
|
}/*:DefinedName*/);
|
2017-04-11 22:15:36 +00:00
|
|
|
if(val.itab > 0) last_lbl.Sheet = val.itab - 1;
|
|
|
|
supbooks.names.push(last_lbl);
|
2017-12-30 05:40:35 +00:00
|
|
|
if(!supbooks[0]) { supbooks[0] = []; supbooks[0].XTI = []; }
|
2017-04-11 22:15:36 +00:00
|
|
|
supbooks[supbooks.length-1].push(val);
|
2017-06-10 01:47:42 +00:00
|
|
|
if(val.Name == "_xlnm._FilterDatabase" && val.itab > 0)
|
2017-04-10 05:10:54 +00:00
|
|
|
if(val.rgce && val.rgce[0] && val.rgce[0][0] && val.rgce[0][0][0] == 'PtgArea3d')
|
|
|
|
FilterDatabases[val.itab - 1] = { ref: encode_range(val.rgce[0][0][1][2]) };
|
|
|
|
break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x0016 /* ExternCount */: opts.ExternCount = val; break;
|
|
|
|
case 0x0017 /* ExternSheet */:
|
2017-04-11 22:15:36 +00:00
|
|
|
if(supbooks.length == 0) { supbooks[0] = []; supbooks[0].XTI = []; }
|
|
|
|
supbooks[supbooks.length - 1].XTI = supbooks[supbooks.length - 1].XTI.concat(val); supbooks.XTI = supbooks.XTI.concat(val); break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x0894 /* NameCmt */:
|
2017-04-11 22:15:36 +00:00
|
|
|
/* TODO: search for correct name */
|
|
|
|
if(opts.biff < 8) break;
|
2017-05-13 18:21:22 +00:00
|
|
|
if(last_lbl != null) last_lbl.Comment = val[1];
|
2017-04-11 22:15:36 +00:00
|
|
|
break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x0012 /* Protect */: out["!protect"] = val; break; /* for sheet or book */
|
|
|
|
case 0x0013 /* Password */: if(val !== 0 && opts.WTF) console.error("Password verifier: " + val); break;
|
|
|
|
case 0x0085 /* BoundSheet8 */: {
|
2023-06-23 09:48:47 +00:00
|
|
|
Directory[opts.biff == 4 ? opts.snames.length : val.pos] = val;
|
2015-04-02 20:32:22 +00:00
|
|
|
opts.snames.push(val.name);
|
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x000a /* EOF */: {
|
2023-06-23 09:48:47 +00:00
|
|
|
if(--file_depth ? !biff4w : biff4w) break;
|
2015-04-02 20:32:22 +00:00
|
|
|
if(range.e) {
|
|
|
|
if(range.e.r > 0 && range.e.c > 0) {
|
|
|
|
range.e.r--; range.e.c--;
|
|
|
|
out["!ref"] = encode_range(range);
|
2018-04-06 06:39:48 +00:00
|
|
|
if(options.sheetRows && options.sheetRows <= range.e.r) {
|
|
|
|
var tmpri = range.e.r;
|
|
|
|
range.e.r = options.sheetRows - 1;
|
|
|
|
out["!fullref"] = out["!ref"];
|
|
|
|
out["!ref"] = encode_range(range);
|
|
|
|
range.e.r = tmpri;
|
|
|
|
}
|
2015-04-02 20:32:22 +00:00
|
|
|
range.e.r++; range.e.c++;
|
|
|
|
}
|
2017-12-30 05:40:35 +00:00
|
|
|
if(merges.length > 0) out["!merges"] = merges;
|
2015-04-02 20:32:22 +00:00
|
|
|
if(objects.length > 0) out["!objects"] = objects;
|
2017-03-20 09:02:25 +00:00
|
|
|
if(colinfo.length > 0) out["!cols"] = colinfo;
|
|
|
|
if(rowinfo.length > 0) out["!rows"] = rowinfo;
|
2017-03-31 18:46:42 +00:00
|
|
|
Workbook.Sheets.push(wsprops);
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
|
|
|
if(cur_sheet === "") Preamble = out; else Sheets[cur_sheet] = out;
|
2022-10-24 01:05:59 +00:00
|
|
|
out = ({}/*:any*/); if(options.dense) out["!data"] = [];
|
2015-04-02 20:32:22 +00:00
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x0009: case 0x0209: case 0x0409: case 0x0809 /* BOF */: {
|
2017-12-30 05:40:35 +00:00
|
|
|
if(opts.biff === 8) opts.biff = {
|
|
|
|
/*::[*/0x0009/*::]*/:2,
|
|
|
|
/*::[*/0x0209/*::]*/:3,
|
|
|
|
/*::[*/0x0409/*::]*/:4
|
|
|
|
}[RecordType] || {
|
2018-02-21 07:01:34 +00:00
|
|
|
/*::[*/0x0200/*::]*/:2,
|
|
|
|
/*::[*/0x0300/*::]*/:3,
|
|
|
|
/*::[*/0x0400/*::]*/:4,
|
2017-12-30 05:40:35 +00:00
|
|
|
/*::[*/0x0500/*::]*/:5,
|
|
|
|
/*::[*/0x0600/*::]*/:8,
|
|
|
|
/*::[*/0x0002/*::]*/:2,
|
|
|
|
/*::[*/0x0007/*::]*/:2
|
|
|
|
}[val.BIFFVer] || 8;
|
2021-09-26 22:51:19 +00:00
|
|
|
opts.biffguess = val.BIFFVer == 0;
|
|
|
|
if(val.BIFFVer == 0 && val.dt == 0x1000) { opts.biff = 5; seen_codepage = true; set_cp(opts.codepage = 28591); }
|
2023-06-23 09:48:47 +00:00
|
|
|
if(opts.biff == 4 && val.dt & 0x100) biff4w = true;
|
2018-08-15 19:22:47 +00:00
|
|
|
if(opts.biff == 8 && val.BIFFVer == 0 && val.dt == 16) opts.biff = 2;
|
2023-06-23 09:48:47 +00:00
|
|
|
if(file_depth++ && !biff4w) break;
|
2022-10-24 01:05:59 +00:00
|
|
|
out = ({}/*:any*/); if(options.dense) out["!data"] = [];
|
2017-03-31 18:46:42 +00:00
|
|
|
|
2017-12-09 07:17:25 +00:00
|
|
|
if(opts.biff < 8 && !seen_codepage) { seen_codepage = true; set_cp(opts.codepage = options.codepage || 1252); }
|
2023-06-23 09:48:47 +00:00
|
|
|
if(opts.biff == 4 && biff4w) {
|
|
|
|
cur_sheet = (Directory[opts.snames.indexOf(cur_sheet)+1] || {name:""}).name;
|
|
|
|
} else if(opts.biff < 5 || val.BIFFVer == 0 && val.dt == 0x1000) {
|
2015-04-02 20:32:22 +00:00
|
|
|
if(cur_sheet === "") cur_sheet = "Sheet1";
|
|
|
|
range = {s:{r:0,c:0},e:{r:0,c:0}};
|
2017-02-10 19:23:01 +00:00
|
|
|
/* fake BoundSheet8 */
|
|
|
|
var fakebs8 = {pos: blob.l - length, name:cur_sheet};
|
|
|
|
Directory[fakebs8.pos] = fakebs8;
|
|
|
|
opts.snames.push(cur_sheet);
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
|
|
|
else cur_sheet = (Directory[s] || {name:""}).name;
|
2017-03-27 21:35:15 +00:00
|
|
|
if(val.dt == 0x20) out["!type"] = "chart";
|
2017-11-20 01:51:14 +00:00
|
|
|
if(val.dt == 0x40) out["!type"] = "macro";
|
2017-12-30 05:40:35 +00:00
|
|
|
merges = [];
|
2015-04-02 20:32:22 +00:00
|
|
|
objects = [];
|
2017-12-30 05:40:35 +00:00
|
|
|
opts.arrayf = arrayf = [];
|
2017-03-20 09:02:25 +00:00
|
|
|
colinfo = []; rowinfo = [];
|
|
|
|
seencol = false;
|
2017-03-31 18:46:42 +00:00
|
|
|
wsprops = {Hidden:(Directory[s]||{hs:0}).hs, name:cur_sheet };
|
2015-04-02 20:32:22 +00:00
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x0203 /* Number */: case 0x0003 /* BIFF2NUM */: case 0x0002 /* BIFF2INT */: {
|
2022-10-24 01:05:59 +00:00
|
|
|
if(out["!type"] == "chart") if(options.dense ? (out["!data"][val.r]||[])[val.c]: out[encode_col(val.c) + encode_row(val.r)]) ++val.c;
|
2017-05-13 18:21:22 +00:00
|
|
|
temp_val = ({ixfe: val.ixfe, XF: XFs[val.ixfe]||{}, v:val.val, t:'n'}/*:any*/);
|
2023-06-23 09:48:47 +00:00
|
|
|
if(BIFF2Fmt > 0) temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
|
2017-02-10 19:23:01 +00:00
|
|
|
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
2015-04-02 20:32:22 +00:00
|
|
|
addcell({c:val.c, r:val.r}, temp_val, options);
|
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x0005: case 0x0205 /* BoolErr */: {
|
2017-05-13 18:21:22 +00:00
|
|
|
temp_val = ({ixfe: val.ixfe, XF: XFs[val.ixfe], v:val.val, t:val.t}/*:any*/);
|
2023-06-23 09:48:47 +00:00
|
|
|
if(BIFF2Fmt > 0) temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
|
2017-02-10 19:23:01 +00:00
|
|
|
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
2015-04-02 20:32:22 +00:00
|
|
|
addcell({c:val.c, r:val.r}, temp_val, options);
|
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x027e /* RK */: {
|
2017-05-13 18:21:22 +00:00
|
|
|
temp_val = ({ixfe: val.ixfe, XF: XFs[val.ixfe], v:val.rknum, t:'n'}/*:any*/);
|
2023-06-23 09:48:47 +00:00
|
|
|
if(BIFF2Fmt > 0) temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
|
2017-02-10 19:23:01 +00:00
|
|
|
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
2015-04-02 20:32:22 +00:00
|
|
|
addcell({c:val.c, r:val.r}, temp_val, options);
|
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x00bd /* MulRk */: {
|
2015-04-02 20:32:22 +00:00
|
|
|
for(var j = val.c; j <= val.C; ++j) {
|
|
|
|
var ixfe = val.rkrec[j-val.c][0];
|
2017-05-13 18:21:22 +00:00
|
|
|
temp_val= ({ixfe:ixfe, XF:XFs[ixfe], v:val.rkrec[j-val.c][1], t:'n'}/*:any*/);
|
2023-06-23 09:48:47 +00:00
|
|
|
if(BIFF2Fmt > 0) temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
|
2017-02-10 19:23:01 +00:00
|
|
|
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
2015-04-02 20:32:22 +00:00
|
|
|
addcell({c:j, r:val.r}, temp_val, options);
|
|
|
|
}
|
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x0006: case 0x0206: case 0x0406 /* Formula */: {
|
2017-03-18 00:45:06 +00:00
|
|
|
if(val.val == 'String') { last_formula = val; break; }
|
2017-05-13 18:21:22 +00:00
|
|
|
temp_val = make_cell(val.val, val.cell.ixfe, val.tt);
|
2017-03-18 00:45:06 +00:00
|
|
|
temp_val.XF = XFs[temp_val.ixfe];
|
|
|
|
if(options.cellFormula) {
|
|
|
|
var _f = val.formula;
|
|
|
|
if(_f && _f[0] && _f[0][0] && _f[0][0][0] == 'PtgExp') {
|
|
|
|
var _fr = _f[0][0][1][0], _fc = _f[0][0][1][1];
|
|
|
|
var _fe = encode_cell({r:_fr, c:_fc});
|
2018-01-09 07:36:02 +00:00
|
|
|
if(sharedf[_fe]) temp_val.f = ""+stringify_formula(val.formula,range,val.cell,supbooks, opts);
|
2022-10-24 01:05:59 +00:00
|
|
|
else temp_val.F = ((options.dense ? (out["!data"][_fr]||[])[_fc]: out[_fe]) || {}).F;
|
2017-03-18 00:45:06 +00:00
|
|
|
} else temp_val.f = ""+stringify_formula(val.formula,range,val.cell,supbooks, opts);
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
2023-06-23 09:48:47 +00:00
|
|
|
if(BIFF2Fmt > 0) temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
|
2017-03-18 00:45:06 +00:00
|
|
|
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
|
|
|
addcell(val.cell, temp_val, options);
|
|
|
|
last_formula = val;
|
2015-04-02 20:32:22 +00:00
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x0007: case 0x0207 /* String */: {
|
2017-03-18 00:45:06 +00:00
|
|
|
if(last_formula) { /* technically always true */
|
2015-04-02 20:32:22 +00:00
|
|
|
last_formula.val = val;
|
2017-05-13 18:21:22 +00:00
|
|
|
temp_val = make_cell(val, last_formula.cell.ixfe, 's');
|
2015-04-02 20:32:22 +00:00
|
|
|
temp_val.XF = XFs[temp_val.ixfe];
|
2017-03-18 00:45:06 +00:00
|
|
|
if(options.cellFormula) {
|
|
|
|
temp_val.f = ""+stringify_formula(last_formula.formula, range, last_formula.cell, supbooks, opts);
|
|
|
|
}
|
2023-06-23 09:48:47 +00:00
|
|
|
if(BIFF2Fmt > 0) temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
|
2017-02-10 19:23:01 +00:00
|
|
|
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
2015-04-02 20:32:22 +00:00
|
|
|
addcell(last_formula.cell, temp_val, options);
|
|
|
|
last_formula = null;
|
2017-03-18 00:45:06 +00:00
|
|
|
} else throw new Error("String record expects Formula");
|
2015-04-02 20:32:22 +00:00
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x0021: case 0x0221 /* Array */: {
|
2017-12-30 05:40:35 +00:00
|
|
|
arrayf.push(val);
|
2017-03-18 00:45:06 +00:00
|
|
|
var _arraystart = encode_cell(val[0].s);
|
2022-10-24 01:05:59 +00:00
|
|
|
cc = options.dense ? (out["!data"][val[0].s.r]||[])[val[0].s.c] : out[_arraystart];
|
2017-04-08 06:55:35 +00:00
|
|
|
if(options.cellFormula && cc) {
|
2017-03-12 18:02:43 +00:00
|
|
|
if(!last_formula) break; /* technically unreachable */
|
2017-04-08 06:55:35 +00:00
|
|
|
if(!_arraystart || !cc) break;
|
|
|
|
cc.f = ""+stringify_formula(val[1], range, val[0], supbooks, opts);
|
|
|
|
cc.F = encode_range(val[0]);
|
2017-02-19 20:36:32 +00:00
|
|
|
}
|
2015-04-02 20:32:22 +00:00
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x04bc /* ShrFmla */: {
|
2017-02-19 20:36:32 +00:00
|
|
|
if(!options.cellFormula) break;
|
|
|
|
if(last_cell) {
|
|
|
|
/* TODO: capture range */
|
2017-03-12 18:02:43 +00:00
|
|
|
if(!last_formula) break; /* technically unreachable */
|
2018-01-09 07:36:02 +00:00
|
|
|
sharedf[encode_cell(last_formula.cell)]= val[0];
|
2022-10-24 01:05:59 +00:00
|
|
|
cc = options.dense ? (out["!data"][last_formula.cell.r]||[])[last_formula.cell.c] : out[encode_cell(last_formula.cell)];
|
2017-04-08 06:55:35 +00:00
|
|
|
(cc||{}).f = ""+stringify_formula(val[0], range, lastcell, supbooks, opts);
|
2017-02-19 20:36:32 +00:00
|
|
|
}
|
2015-04-02 20:32:22 +00:00
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x00fd /* LabelSst */:
|
2015-04-02 20:32:22 +00:00
|
|
|
temp_val=make_cell(sst[val.isst].t, val.ixfe, 's');
|
2019-11-15 01:46:49 +00:00
|
|
|
if(sst[val.isst].h) temp_val.h = sst[val.isst].h;
|
2015-04-02 20:32:22 +00:00
|
|
|
temp_val.XF = XFs[temp_val.ixfe];
|
2023-06-23 09:48:47 +00:00
|
|
|
if(BIFF2Fmt > 0) temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
|
2017-02-10 19:23:01 +00:00
|
|
|
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
2015-04-02 20:32:22 +00:00
|
|
|
addcell({c:val.c, r:val.r}, temp_val, options);
|
|
|
|
break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x0201 /* Blank */: if(options.sheetStubs) {
|
2017-05-13 18:21:22 +00:00
|
|
|
temp_val = ({ixfe: val.ixfe, XF: XFs[val.ixfe], t:'z'}/*:any*/);
|
2023-06-23 09:48:47 +00:00
|
|
|
if(BIFF2Fmt > 0) temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
|
2017-03-15 08:19:02 +00:00
|
|
|
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
|
|
|
addcell({c:val.c, r:val.r}, temp_val, options);
|
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x00be /* MulBlank */: if(options.sheetStubs) {
|
2017-03-15 08:19:02 +00:00
|
|
|
for(var _j = val.c; _j <= val.C; ++_j) {
|
|
|
|
var _ixfe = val.ixfe[_j-val.c];
|
2017-05-13 18:21:22 +00:00
|
|
|
temp_val= ({ixfe:_ixfe, XF:XFs[_ixfe], t:'z'}/*:any*/);
|
2023-06-23 09:48:47 +00:00
|
|
|
if(BIFF2Fmt > 0) temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
|
2017-03-15 08:19:02 +00:00
|
|
|
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
|
|
|
addcell({c:_j, r:val.r}, temp_val, options);
|
|
|
|
}
|
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x00d6 /* RString */:
|
|
|
|
case 0x0204 /* Label */: case 0x0004 /* BIFF2STR */:
|
2015-04-02 20:32:22 +00:00
|
|
|
temp_val=make_cell(val.val, val.ixfe, 's');
|
|
|
|
temp_val.XF = XFs[temp_val.ixfe];
|
2023-06-23 09:48:47 +00:00
|
|
|
if(BIFF2Fmt > 0) temp_val.z = (temp_val.XF && temp_val.XF.numFmtId) && BIFF2FmtTable[temp_val.XF.numFmtId] || BIFF2FmtTable[(temp_val.ixfe>>8) & 0x3F];
|
2017-02-10 19:23:01 +00:00
|
|
|
safe_format_xf(temp_val, options, wb.opts.Date1904);
|
2015-04-02 20:32:22 +00:00
|
|
|
addcell({c:val.c, r:val.r}, temp_val, options);
|
|
|
|
break;
|
2017-03-18 00:45:06 +00:00
|
|
|
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x0000: case 0x0200 /* Dimensions */: {
|
2015-04-02 20:32:22 +00:00
|
|
|
if(file_depth === 1) range = val; /* TODO: stack */
|
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x00fc /* SST */: {
|
2015-04-02 20:32:22 +00:00
|
|
|
sst = val;
|
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x041e /* Format */: { /* val = [id, fmt] */
|
2023-06-23 09:48:47 +00:00
|
|
|
if(opts.biff >= 3 && opts.biff <= 4) {
|
2017-12-01 05:48:10 +00:00
|
|
|
BIFF2FmtTable[BIFF2Fmt++] = val[1];
|
2022-03-20 01:54:41 +00:00
|
|
|
for(var b4idx = 0; b4idx < BIFF2Fmt + 163; ++b4idx) if(table_fmt[b4idx] == val[1]) break;
|
2022-04-06 02:14:12 +00:00
|
|
|
if(b4idx >= 163) SSF__load(val[1], BIFF2Fmt + 163);
|
2017-12-01 05:48:10 +00:00
|
|
|
}
|
2022-04-06 02:14:12 +00:00
|
|
|
else SSF__load(val[1], val[0]);
|
2015-04-02 20:32:22 +00:00
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x001e /* BIFF2FORMAT */: {
|
2017-05-09 18:07:57 +00:00
|
|
|
BIFF2FmtTable[BIFF2Fmt++] = val;
|
2022-03-20 01:54:41 +00:00
|
|
|
for(var b2idx = 0; b2idx < BIFF2Fmt + 163; ++b2idx) if(table_fmt[b2idx] == val) break;
|
2022-04-06 02:14:12 +00:00
|
|
|
if(b2idx >= 163) SSF__load(val, BIFF2Fmt + 163);
|
2017-02-10 19:23:01 +00:00
|
|
|
} break;
|
2015-04-02 20:32:22 +00:00
|
|
|
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x00e5 /* MergeCells */: merges = merges.concat(val); break;
|
2015-04-02 20:32:22 +00:00
|
|
|
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x005d /* Obj */: objects[val.cmo[0]] = opts.lastobj = val; break;
|
|
|
|
case 0x01b6 /* TxO */: opts.lastobj.TxO = val; break;
|
|
|
|
case 0x007f /* ImData */: opts.lastobj.ImData = val; break;
|
2015-04-02 20:32:22 +00:00
|
|
|
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x01b8 /* HLink */: {
|
2015-04-02 20:32:22 +00:00
|
|
|
for(rngR = val[0].s.r; rngR <= val[0].e.r; ++rngR)
|
2017-04-08 06:55:35 +00:00
|
|
|
for(rngC = val[0].s.c; rngC <= val[0].e.c; ++rngC) {
|
2022-10-24 01:05:59 +00:00
|
|
|
cc = options.dense ? (out["!data"][rngR]||[])[rngC] : out[encode_cell({c:rngC,r:rngR})];
|
2017-04-08 06:55:35 +00:00
|
|
|
if(cc) cc.l = val[1];
|
2017-05-09 18:07:57 +00:00
|
|
|
}
|
2015-04-02 20:32:22 +00:00
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x0800 /* HLinkTooltip */: {
|
2015-04-02 20:32:22 +00:00
|
|
|
for(rngR = val[0].s.r; rngR <= val[0].e.r; ++rngR)
|
2017-04-08 06:55:35 +00:00
|
|
|
for(rngC = val[0].s.c; rngC <= val[0].e.c; ++rngC) {
|
2022-10-24 01:05:59 +00:00
|
|
|
cc = options.dense ? (out["!data"][rngR]||[])[rngC] : out[encode_cell({c:rngC,r:rngR})];
|
2018-02-21 07:01:34 +00:00
|
|
|
if(cc && cc.l) cc.l.Tooltip = val[1];
|
2017-04-08 06:55:35 +00:00
|
|
|
}
|
2015-04-02 20:32:22 +00:00
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x001c /* Note */: {
|
2023-06-13 04:49:18 +00:00
|
|
|
/* TODO: comment continuation (row == -1 / 0xFFFF) */
|
2022-10-24 01:05:59 +00:00
|
|
|
cc = options.dense ? (out["!data"][val[0].r]||[])[val[0].c] : out[encode_cell(val[0])];
|
2019-08-03 22:37:04 +00:00
|
|
|
if(!cc) {
|
|
|
|
if(options.dense) {
|
2022-10-24 01:05:59 +00:00
|
|
|
if(!out["!data"][val[0].r]) out["!data"][val[0].r] = [];
|
|
|
|
cc = out["!data"][val[0].r][val[0].c] = ({t:"z"}/*:any*/);
|
2019-08-03 22:37:04 +00:00
|
|
|
} else {
|
2019-11-01 03:09:14 +00:00
|
|
|
cc = out[encode_cell(val[0])] = ({t:"z"}/*:any*/);
|
2019-08-03 22:37:04 +00:00
|
|
|
}
|
|
|
|
range.e.r = Math.max(range.e.r, val[0].r);
|
|
|
|
range.s.r = Math.min(range.s.r, val[0].r);
|
|
|
|
range.e.c = Math.max(range.e.c, val[0].c);
|
|
|
|
range.s.c = Math.min(range.s.c, val[0].c);
|
|
|
|
}
|
2015-04-02 20:32:22 +00:00
|
|
|
if(!cc.c) cc.c = [];
|
2023-06-13 04:49:18 +00:00
|
|
|
if(opts.biff <= 5 && opts.biff >= 2) cmnt = {a:"SheetJ5", t:val[1]};
|
|
|
|
else {
|
|
|
|
var noteobj = objects[val[2]];
|
|
|
|
cmnt = {a:val[1],t:noteobj.TxO.t};
|
|
|
|
if(val[3] != null && !(val[3] & 0x02)) cc.c.hidden = true;
|
|
|
|
}
|
2015-04-02 20:32:22 +00:00
|
|
|
cc.c.push(cmnt);
|
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x087d /* XFExt */: update_xfext(XFs[val.ixfe], val.ext); break;
|
|
|
|
case 0x007d /* ColInfo */: {
|
2017-03-20 09:02:25 +00:00
|
|
|
if(!opts.cellStyles) break;
|
|
|
|
while(val.e >= val.s) {
|
2021-09-20 06:38:41 +00:00
|
|
|
colinfo[val.e--] = { width: val.w/256, level: (val.level || 0), hidden: !!(val.flags & 1) };
|
2017-03-20 09:02:25 +00:00
|
|
|
if(!seencol) { seencol = true; find_mdw_colw(val.w/256); }
|
|
|
|
process_col(colinfo[val.e+1]);
|
|
|
|
}
|
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x0208 /* Row */: {
|
2017-04-28 07:28:03 +00:00
|
|
|
var rowobj = {};
|
2017-07-09 17:37:45 +00:00
|
|
|
if(val.level != null) { rowinfo[val.r] = rowobj; rowobj.level = val.level; }
|
2017-04-28 07:28:03 +00:00
|
|
|
if(val.hidden) { rowinfo[val.r] = rowobj; rowobj.hidden = true; }
|
|
|
|
if(val.hpt) {
|
|
|
|
rowinfo[val.r] = rowobj;
|
|
|
|
rowobj.hpt = val.hpt; rowobj.hpx = pt2px(val.hpt);
|
|
|
|
}
|
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x0026 /* LeftMargin */:
|
|
|
|
case 0x0027 /* RightMargin */:
|
|
|
|
case 0x0028 /* TopMargin */:
|
|
|
|
case 0x0029 /* BottomMargin */:
|
2017-04-13 01:29:38 +00:00
|
|
|
if(!out['!margins']) default_margins(out['!margins'] = {});
|
2022-03-12 14:05:57 +00:00
|
|
|
out['!margins'][({0x26: "left", 0x27:"right", 0x28:"top", 0x29:"bottom"})[RecordType]] = val;
|
2017-04-13 01:29:38 +00:00
|
|
|
break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x00a1 /* Setup */: // TODO
|
2017-04-13 01:29:38 +00:00
|
|
|
if(!out['!margins']) default_margins(out['!margins'] = {});
|
|
|
|
out['!margins'].header = val.header;
|
|
|
|
out['!margins'].footer = val.footer;
|
|
|
|
break;
|
2022-03-12 14:05:57 +00:00
|
|
|
case 0x023e /* Window2 */: // TODO
|
2017-12-30 05:40:35 +00:00
|
|
|
// $FlowIgnore
|
|
|
|
if(val.RTL) Workbook.Views[0].RTL = true;
|
|
|
|
break;
|
2022-03-16 03:18:09 +00:00
|
|
|
case 0x0092 /* Palette */: palette = val; break;
|
|
|
|
case 0x0896 /* Theme */: themes = val; break;
|
|
|
|
case 0x008c /* Country */: country = val; break;
|
|
|
|
case 0x01ba /* CodeName */: {
|
|
|
|
/*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */
|
|
|
|
if(!cur_sheet) Workbook.WBProps.CodeName = val || "ThisWorkbook";
|
|
|
|
else wsprops.CodeName = val || wsprops.name;
|
|
|
|
} break;
|
2022-03-12 14:05:57 +00:00
|
|
|
}
|
2022-03-20 01:54:41 +00:00
|
|
|
} else {
|
|
|
|
if(!R) console.error("Missing Info for XLS Record 0x" + RecordType.toString(16));
|
|
|
|
blob.l += length;
|
|
|
|
}
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
2018-01-23 09:07:51 +00:00
|
|
|
wb.SheetNames=keys(Directory).sort(function(a,b) { return Number(a) - Number(b); }).map(function(x){return Directory[x].name;});
|
2015-04-02 20:32:22 +00:00
|
|
|
if(!options.bookSheets) wb.Sheets=Sheets;
|
2021-09-16 23:40:52 +00:00
|
|
|
if(!wb.SheetNames.length && Preamble["!ref"]) {
|
|
|
|
wb.SheetNames.push("Sheet1");
|
2021-12-29 09:16:02 +00:00
|
|
|
/*jshint -W069 */
|
2021-09-16 23:40:52 +00:00
|
|
|
if(wb.Sheets) wb.Sheets["Sheet1"] = Preamble;
|
2021-12-29 09:16:02 +00:00
|
|
|
/*jshint +W069 */
|
2021-09-16 23:40:52 +00:00
|
|
|
} else wb.Preamble=Preamble;
|
2017-04-10 05:10:54 +00:00
|
|
|
if(wb.Sheets) FilterDatabases.forEach(function(r,i) { wb.Sheets[wb.SheetNames[i]]['!autofilter'] = r; });
|
2015-04-02 20:32:22 +00:00
|
|
|
wb.Strings = sst;
|
2022-03-20 01:54:41 +00:00
|
|
|
wb.SSF = dup(table_fmt);
|
2015-04-02 20:32:22 +00:00
|
|
|
if(opts.enc) wb.Encryption = opts.enc;
|
2017-12-30 05:40:35 +00:00
|
|
|
if(themes) wb.Themes = themes;
|
2015-04-02 20:32:22 +00:00
|
|
|
wb.Metadata = {};
|
|
|
|
if(country !== undefined) wb.Metadata.Country = country;
|
2017-04-11 22:15:36 +00:00
|
|
|
if(supbooks.names.length > 0) Workbook.Names = supbooks.names;
|
2017-03-31 18:46:42 +00:00
|
|
|
wb.Workbook = Workbook;
|
2015-04-02 20:32:22 +00:00
|
|
|
return wb;
|
|
|
|
}
|
|
|
|
|
2018-05-05 06:34:37 +00:00
|
|
|
/* TODO: split props*/
|
|
|
|
var PSCLSID = {
|
|
|
|
SI: "e0859ff2f94f6810ab9108002b27b3d9",
|
|
|
|
DSI: "02d5cdd59c2e1b10939708002b2cf9ae",
|
|
|
|
UDI: "05d5cdd59c2e1b10939708002b2cf9ae"
|
|
|
|
};
|
|
|
|
function parse_xls_props(cfb/*:CFBContainer*/, props, o) {
|
2017-04-30 16:27:03 +00:00
|
|
|
/* [MS-OSHARED] 2.3.3.2.2 Document Summary Information Property Set */
|
2022-01-25 07:52:05 +00:00
|
|
|
var DSI = CFB.find(cfb, '/!DocumentSummaryInformation');
|
2018-02-14 20:06:35 +00:00
|
|
|
if(DSI && DSI.size > 0) try {
|
2018-05-05 06:34:37 +00:00
|
|
|
var DocSummary = parse_PropertySetStream(DSI, DocSummaryPIDDSI, PSCLSID.DSI);
|
2017-09-30 06:18:11 +00:00
|
|
|
for(var d in DocSummary) props[d] = DocSummary[d];
|
2017-12-30 05:40:35 +00:00
|
|
|
} catch(e) {if(o.WTF) throw e;/* empty */}
|
2017-04-30 16:27:03 +00:00
|
|
|
|
|
|
|
/* [MS-OSHARED] 2.3.3.2.1 Summary Information Property Set*/
|
2022-01-25 07:52:05 +00:00
|
|
|
var SI = CFB.find(cfb, '/!SummaryInformation');
|
2018-02-14 20:06:35 +00:00
|
|
|
if(SI && SI.size > 0) try {
|
2018-05-05 06:34:37 +00:00
|
|
|
var Summary = parse_PropertySetStream(SI, SummaryPIDSI, PSCLSID.SI);
|
2017-09-30 06:18:11 +00:00
|
|
|
for(var s in Summary) if(props[s] == null) props[s] = Summary[s];
|
2017-12-30 05:40:35 +00:00
|
|
|
} catch(e) {if(o.WTF) throw e;/* empty */}
|
2018-05-05 06:34:37 +00:00
|
|
|
|
|
|
|
if(props.HeadingPairs && props.TitlesOfParts) {
|
|
|
|
load_props_pairs(props.HeadingPairs, props.TitlesOfParts, props, o);
|
|
|
|
delete props.HeadingPairs; delete props.TitlesOfParts;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function write_xls_props(wb/*:Workbook*/, cfb/*:CFBContainer*/) {
|
|
|
|
var DSEntries = [], SEntries = [], CEntries = [];
|
|
|
|
var i = 0, Keys;
|
2022-03-14 06:51:33 +00:00
|
|
|
var DocSummaryRE/*:{[key:string]:string}*/ = evert_key(DocSummaryPIDDSI, "n");
|
|
|
|
var SummaryRE/*:{[key:string]:string}*/ = evert_key(SummaryPIDSI, "n");
|
2018-05-05 06:34:37 +00:00
|
|
|
if(wb.Props) {
|
|
|
|
Keys = keys(wb.Props);
|
2018-05-20 01:34:59 +00:00
|
|
|
// $FlowIgnore
|
2020-03-15 07:42:05 +00:00
|
|
|
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]]]);
|
2018-05-05 06:34:37 +00:00
|
|
|
}
|
|
|
|
if(wb.Custprops) {
|
|
|
|
Keys = keys(wb.Custprops);
|
2018-05-20 01:34:59 +00:00
|
|
|
// $FlowIgnore
|
2020-03-15 07:42:05 +00:00
|
|
|
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]]]);
|
2018-05-05 06:34:37 +00:00
|
|
|
}
|
|
|
|
var CEntries2 = [];
|
|
|
|
for(i = 0; i < CEntries.length; ++i) {
|
2022-03-14 06:51:33 +00:00
|
|
|
if(XLSPSSkip.indexOf(CEntries[i][0]) > -1 || PseudoPropsPairs.indexOf(CEntries[i][0]) > -1) continue;
|
2018-05-05 06:34:37 +00:00
|
|
|
if(CEntries[i][1] == null) continue;
|
|
|
|
CEntries2.push(CEntries[i]);
|
|
|
|
}
|
|
|
|
if(SEntries.length) CFB.utils.cfb_add(cfb, "/\u0005SummaryInformation", write_PropertySetStream(SEntries, PSCLSID.SI, SummaryRE, SummaryPIDSI));
|
|
|
|
if(DSEntries.length || CEntries2.length) CFB.utils.cfb_add(cfb, "/\u0005DocumentSummaryInformation", write_PropertySetStream(DSEntries, PSCLSID.DSI, DocSummaryRE, DocSummaryPIDDSI, CEntries2.length ? CEntries2 : null, PSCLSID.UDI));
|
2017-04-30 16:27:03 +00:00
|
|
|
}
|
|
|
|
|
2017-03-12 18:02:43 +00:00
|
|
|
function parse_xlscfb(cfb/*:any*/, options/*:?ParseOpts*/)/*:Workbook*/ {
|
2015-04-02 20:32:22 +00:00
|
|
|
if(!options) options = {};
|
|
|
|
fix_read_opts(options);
|
|
|
|
reset_cp();
|
2017-12-30 05:40:35 +00:00
|
|
|
if(options.codepage) set_ansi(options.codepage);
|
2018-01-23 09:07:51 +00:00
|
|
|
var CompObj/*:?CFBEntry*/, WB/*:?any*/;
|
2017-02-10 19:23:01 +00:00
|
|
|
if(cfb.FullPaths) {
|
2017-12-30 05:40:35 +00:00
|
|
|
if(CFB.find(cfb, '/encryption')) throw new Error("File is password-protected");
|
2017-08-09 22:38:23 +00:00
|
|
|
CompObj = CFB.find(cfb, '!CompObj');
|
2017-09-30 06:18:11 +00:00
|
|
|
WB = CFB.find(cfb, '/Workbook') || CFB.find(cfb, '/Book');
|
2015-04-02 20:32:22 +00:00
|
|
|
} else {
|
2017-08-19 23:06:34 +00:00
|
|
|
switch(options.type) {
|
2022-03-22 20:08:08 +00:00
|
|
|
case 'base64': cfb = s2a(Base64_decode(cfb)); break;
|
2017-08-19 23:06:34 +00:00
|
|
|
case 'binary': cfb = s2a(cfb); break;
|
|
|
|
case 'buffer': break;
|
|
|
|
case 'array': if(!Array.isArray(cfb)) cfb = Array.prototype.slice.call(cfb); break;
|
|
|
|
}
|
2015-04-02 20:32:22 +00:00
|
|
|
prep_blob(cfb, 0);
|
2017-08-09 22:38:23 +00:00
|
|
|
WB = ({content: cfb}/*:any*/);
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
2018-01-23 09:07:51 +00:00
|
|
|
var /*::CompObjP, */WorkbookP/*:: :Workbook = XLSX.utils.book_new(); */;
|
2015-04-02 20:32:22 +00:00
|
|
|
|
2017-08-09 22:38:23 +00:00
|
|
|
var _data/*:?any*/;
|
2018-01-23 09:07:51 +00:00
|
|
|
if(CompObj) /*::CompObjP = */parse_compobj(CompObj);
|
2017-03-12 18:02:43 +00:00
|
|
|
if(options.bookProps && !options.bookSheets) WorkbookP = ({}/*:any*/);
|
2017-09-30 06:18:11 +00:00
|
|
|
else/*:: if(cfb instanceof CFBContainer) */ {
|
|
|
|
var T = has_buf ? 'buffer' : 'array';
|
2017-08-09 22:38:23 +00:00
|
|
|
if(WB && WB.content) WorkbookP = parse_workbook(WB.content, options);
|
2017-04-04 16:09:41 +00:00
|
|
|
/* Quattro Pro 7-8 */
|
2017-09-30 06:18:11 +00:00
|
|
|
else if((_data=CFB.find(cfb, 'PerfectOffice_MAIN')) && _data.content) WorkbookP = WK_.to_workbook(_data.content, (options.type = T, options));
|
2017-04-04 16:09:41 +00:00
|
|
|
/* Quattro Pro 9 */
|
2017-09-30 06:18:11 +00:00
|
|
|
else if((_data=CFB.find(cfb, 'NativeContent_MAIN')) && _data.content) WorkbookP = WK_.to_workbook(_data.content, (options.type = T, options));
|
2021-12-29 09:16:02 +00:00
|
|
|
/* Works 4 for Mac */
|
|
|
|
else if((_data=CFB.find(cfb, 'MN0')) && _data.content) throw new Error("Unsupported Works 4 for Mac file");
|
2015-04-02 20:32:22 +00:00
|
|
|
else throw new Error("Cannot find Workbook stream");
|
2017-11-15 18:14:02 +00:00
|
|
|
if(options.bookVBA && cfb.FullPaths && CFB.find(cfb, '/_VBA_PROJECT_CUR/VBA/dir')) WorkbookP.vbaraw = make_vba_xls(cfb);
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var props = {};
|
2018-05-05 06:34:37 +00:00
|
|
|
if(cfb.FullPaths) parse_xls_props(/*::((*/cfb/*:: :any):CFBContainer)*/, props, options);
|
2017-09-30 06:18:11 +00:00
|
|
|
|
2015-04-02 20:32:22 +00:00
|
|
|
WorkbookP.Props = WorkbookP.Custprops = props; /* TODO: split up properties */
|
|
|
|
if(options.bookFiles) WorkbookP.cfb = cfb;
|
2017-03-12 18:02:43 +00:00
|
|
|
/*WorkbookP.CompObjP = CompObjP; // TODO: storage? */
|
2015-04-02 20:32:22 +00:00
|
|
|
return WorkbookP;
|
|
|
|
}
|
|
|
|
|
2017-09-22 22:18:51 +00:00
|
|
|
|
|
|
|
function write_xlscfb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:CFBContainer*/ {
|
|
|
|
var o = opts || {};
|
|
|
|
var cfb = CFB.utils.cfb_new({root:"R"});
|
|
|
|
var wbpath = "/Workbook";
|
|
|
|
switch(o.bookType || "xls") {
|
|
|
|
case "xls": o.bookType = "biff8";
|
|
|
|
/* falls through */
|
2017-12-30 05:40:35 +00:00
|
|
|
case "xla": if(!o.bookType) o.bookType = "xla";
|
|
|
|
/* falls through */
|
2017-09-22 22:18:51 +00:00
|
|
|
case "biff8": wbpath = "/Workbook"; o.biff = 8; break;
|
|
|
|
case "biff5": wbpath = "/Book"; o.biff = 5; break;
|
|
|
|
default: throw new Error("invalid type " + o.bookType + " for XLS CFB");
|
|
|
|
}
|
|
|
|
CFB.utils.cfb_add(cfb, wbpath, write_biff_buf(wb, o));
|
2018-05-05 06:34:37 +00:00
|
|
|
if(o.biff == 8 && (wb.Props || wb.Custprops)) write_xls_props(wb, cfb);
|
2017-09-22 22:18:51 +00:00
|
|
|
// TODO: SI, DSI, CO
|
2017-10-27 16:25:54 +00:00
|
|
|
if(o.biff == 8 && wb.vbaraw) fill_vba_xls(cfb, CFB.read(wb.vbaraw, {type: typeof wb.vbaraw == "string" ? "binary" : "buffer"}));
|
2017-09-22 22:18:51 +00:00
|
|
|
return cfb;
|
|
|
|
}
|