diff --git a/index.html b/index.html
index 772f844..e4fccd4 100644
--- a/index.html
+++ b/index.html
@@ -20,14 +20,14 @@
-JS-XLSX Live Demo
+JS-XLSX (XLSX/XLSB/XLSM) Live Demo
Github Repo
Issues? Something look weird? Click here and report an issue
CSV
JSON
FORMULAE
-Drop an XLSX or XLSM file here to see sheet data.
+Drop an XLSX or XLSM or XLSB file here to see sheet data.
diff --git a/xlsx.js b/xlsx.js
index e885a4f..56d1df2 100644
--- a/xlsx.js
+++ b/xlsx.js
@@ -419,7 +419,42 @@ SSF.load_table = function(tbl) { for(var i=0; i!=0x0188; ++i) if(tbl[i]) SSF.loa
make_ssf(SSF);
var XLSX = {};
(function(XLSX){
-XLSX.version = '0.3.10';
+XLSX.version = '0.4.0';
+if(typeof module !== "undefined" && typeof require !== 'undefined') {
+ if(typeof cptable === 'undefined') var cptable = require('codepage');
+ var current_codepage = 1252, current_cptable = cptable[1252];
+}
+function reset_cp() {
+ current_codepage = 1252; if(typeof cptable !== 'undefined') current_cptable = cptable[1252];
+}
+function _getchar(x) { return String.fromCharCode(x); }
+
+function getdata(data) {
+ if(!data) return null;
+ if(data.data) return data.data;
+ if(data._data && data._data.getContent) {
+ /* TODO: something far more intelligent */
+ if(data.name.substr(-4) === ".bin") return Array.prototype.slice.call(data._data.getContent());
+ return Array.prototype.slice.call(data._data.getContent(),0).map(function(x) { return String.fromCharCode(x); }).join("");
+ }
+ return null;
+}
+
+function getzipfile(zip, file) {
+ var f = file; if(zip.files[f]) return zip.files[f];
+ f = file.toLowerCase(); if(zip.files[f]) return zip.files[f];
+ f = f.replace(/\//g,'\\'); if(zip.files[f]) return zip.files[f];
+ throw new Error("Cannot find file " + file + " in zip");
+}
+
+var _fs, jszip;
+if(typeof JSZip !== 'undefined') jszip = JSZip;
+if (typeof exports !== 'undefined') {
+ if (typeof module !== 'undefined' && module.exports) {
+ if(typeof jszip === 'undefined') jszip = require('./jszip').JSZip;
+ _fs = require('fs');
+ }
+}
function parsexmltag(tag) {
var words = tag.split(/\s+/);
var z = {'0': words[0]};
@@ -429,6 +464,12 @@ function parsexmltag(tag) {
return z;
}
+function evert(obj) {
+ var o = {};
+ Object.keys(obj).forEach(function(k) { if(obj.hasOwnProperty(k)) o[obj[k]] = k; });
+ return o;
+}
+
var encodings = {
'"': '"',
''': "'",
@@ -436,13 +477,21 @@ var encodings = {
'<': '<',
'&': '&'
};
-
+var rencoding = evert(encodings);
+var rencstr = "&<>'\"".split("");
+
// TODO: CP remap (need to read file version to determine OS)
function unescapexml(text){
var s = text + '';
for(var y in encodings) s = s.replace(new RegExp(y,'g'), encodings[y]);
return s.replace(/_x([0-9a-fA-F]*)_/g,function(m,c) {return _chr(parseInt(c,16));});
}
+function escapexml(text){
+ var s = text + '';
+ rencstr.forEach(function(y){s=s.replace(new RegExp(y,'g'), rencoding[y]);});
+ return s;
+}
+
function parsexmlbool(value, tag) {
switch(value) {
@@ -486,6 +535,264 @@ function parseVector(data) {
}
function isval(x) { return typeof x !== "undefined" && x !== null; }
+function readIEEE754(buf, idx, isLE, nl, ml) {
+ if(isLE === undefined) isLE = true;
+ if(!nl) nl = 8;
+ if(!ml && nl === 8) ml = 52;
+ var e, m, el = nl * 8 - ml - 1, eMax = (1 << el) - 1, eBias = eMax >> 1;
+ var bits = -7, d = isLE ? -1 : 1, i = isLE ? (nl - 1) : 0, s = buf[idx + i];
+
+ i += d;
+ e = s & ((1 << (-bits)) - 1); s >>>= (-bits); bits += el;
+ for (; bits > 0; e = e * 256 + buf[idx + i], i += d, bits -= 8);
+ m = e & ((1 << (-bits)) - 1); e >>>= (-bits); bits += ml;
+ for (; bits > 0; m = m * 256 + buf[idx + i], i += d, bits -= 8);
+ if (e === eMax) return m ? NaN : ((s ? -1 : 1) * Infinity);
+ else if (e === 0) e = 1 - eBias;
+ else { m = m + Math.pow(2, ml); e = e - eBias; }
+ return (s ? -1 : 1) * m * Math.pow(2, e - ml);
+}
+
+function s2a(s) {
+ if(typeof Buffer !== 'undefined') return new Buffer(s, "binary");
+ var w = s.split("").map(function(x){ return x.charCodeAt(0) & 0xff; });
+ return w;
+}
+
+var __toBuffer;
+if(typeof Buffer !== "undefined") {
+ Buffer.prototype.hexlify= function() { return this.toString('hex'); };
+ Buffer.prototype.utf16le= function(s,e){return this.toString('utf16le',s,e).replace(/\u0000/,'').replace(/[\u0001-\u0006]/,'!');};
+ Buffer.prototype.utf8 = function(s,e) { return this.toString('utf8',s,e); };
+ Buffer.prototype.lpstr = function(i) { var len = this.readUInt32LE(i); return len > 0 ? this.utf8(i+4,i+4+len-1) : "";};
+ Buffer.prototype.lpwstr = function(i) { var len = 2*this.readUInt32LE(i); return this.utf8(i+4,i+4+len-1);};
+ if(typeof cptable !== "undefined") Buffer.prototype.lpstr = function(i) {
+ var len = this.readUInt32LE(i);
+ if(len === 0) return "";
+ if(typeof current_cptable === "undefined") return this.utf8(i+4,i+4+len-1);
+ var t = Array(this.slice(i+4,i+4+len-1));
+ //1console.log("start", this.l, len, t);
+ var c, j = i+4, o = "", cc;
+ for(;j!=i+4+len;++j) {
+ c = this.readUInt8(j);
+ cc = current_cptable.dec[c];
+ if(typeof cc === 'undefined') {
+ c = c*256 + this.readUInt8(++j);
+ cc = current_cptable.dec[c];
+ }
+ if(typeof cc === 'undefined') throw "Unrecognized character " + c.toString(16);
+ if(c === 0) break;
+ o += cc;
+ //1console.log(cc, cc.charCodeAt(0), o, this.l);
+ }
+ return o;
+ };
+ __toBuffer = function(bufs) { return Buffer.concat(bufs[0]); };
+} else {
+ __toBuffer = function(bufs) {
+ var x = [];
+ for(var i = 0; i != bufs[0].length; ++i) { x = x.concat(bufs[0][i]); }
+ return x;
+ };
+}
+
+var __readUInt8 = function(b, idx) { return b.readUInt8 ? b.readUInt8(idx) : b[idx]; };
+var __readUInt16LE = function(b, idx) { return b.readUInt16LE ? b.readUInt16LE(idx) : b[idx+1]*(1<<8)+b[idx]; };
+var __readInt16LE = function(b, idx) { var u = __readUInt16LE(b,idx); if(!(u & 0x8000)) return u; return (0xffff - u + 1) * -1; };
+var __readUInt32LE = function(b, idx) { return b.readUInt32LE ? b.readUInt32LE(idx) : b[idx+3]*(1<<24)+b[idx+2]*(1<<16)+b[idx+1]*(1<<8)+b[idx]; };
+var __readInt32LE = function(b, idx) { if(b.readInt32LE) return b.readInt32LE(idx); var u = __readUInt32LE(b,idx); if(!(u & 0x80000000)) return u; return (0xffffffff - u + 1) * -1; };
+var __readDoubleLE = function(b, idx) { return b.readDoubleLE ? b.readDoubleLE(idx) : readIEEE754(b, idx||0);};
+
+var __hexlify = function(b) { return b.map(function(x){return (x<16?"0":"") + x.toString(16);}).join(""); };
+
+var __utf16le = function(b,s,e) { if(b.utf16le) return b.utf16le(s,e); var str = ""; for(var i=s; i 0 ? __utf8(b, i+4,i+4+len-1) : "";};
+var __lpwstr = function(b,i) { if(b.lpwstr) return b.lpwstr(i); var len = 2*__readUInt32LE(b,i); return __utf8(b, i+4,i+4+len-1);};
+
+function bconcat(bufs) { return (typeof Buffer !== 'undefined') ? Buffer.concat(bufs) : [].concat.apply([], bufs); }
+
+function ReadShift(size, t) {
+ var o, w, vv, i, loc; t = t || 'u';
+ if(size === 'ieee754') { size = 8; t = 'f'; }
+ switch(size) {
+ case 1: o = __readUInt8(this, this.l); break;
+ case 2: o=(t==='u' ? __readUInt16LE : __readInt16LE)(this, this.l); break;
+ case 4: o = __readUInt32LE(this, this.l); break;
+ case 8: if(t === 'f') { o = __readDoubleLE(this, this.l); break; }
+ /* falls through */
+ case 16: o = this.toString('hex', this.l,this.l+size); break;
+
+ case 'utf8': size = t; o = __utf8(this, this.l, this.l + size); break;
+ case 'utf16le': size=2*t; o = __utf16le(this, this.l, this.l + size); break;
+
+ /* [MS-OLEDS] 2.1.4 LengthPrefixedAnsiString */
+ case 'lpstr': o = __lpstr(this, this.l); size = 5 + o.length; break;
+
+ case 'lpwstr': o = __lpwstr(this, this.l); size = 5 + o.length; if(o[o.length-1] == '\u0000') size += 2; break;
+
+ /* sbcs and dbcs support continue records in the SST way TODO codepages */
+ /* TODO: DBCS http://msdn.microsoft.com/en-us/library/cc194788.aspx */
+ case 'dbcs': size = 2*t; o = ""; loc = this.l;
+ for(i = 0; i != t; ++i) {
+ if(this.lens && this.lens.indexOf(loc) !== -1) {
+ w = __readUInt8(this, loc);
+ this.l = loc + 1;
+ vv = ReadShift.call(this, w ? 'dbcs' : 'sbcs', t-i);
+ return o + vv;
+ }
+ o += _getchar(__readUInt16LE(this, loc));
+ loc+=2;
+ } break;
+
+ case 'sbcs': size = t; o = ""; loc = this.l;
+ for(i = 0; i != t; ++i) {
+ if(this.lens && this.lens.indexOf(loc) !== -1) {
+ w = __readUInt8(this, loc);
+ this.l = loc + 1;
+ vv = ReadShift.call(this, w ? 'dbcs' : 'sbcs', t-i);
+ return o + vv;
+ }
+ o += _getchar(__readUInt8(this, loc));
+ loc+=1;
+ } break;
+
+ case 'cstr': size = 0; o = "";
+ while((w=__readUInt8(this, this.l + size++))!==0) o+= _getchar(w);
+ break;
+ case 'wstr': size = 0; o = "";
+ while((w=__readUInt16LE(this,this.l +size))!==0){o+= _getchar(w);size+=2;}
+ size+=2; break;
+ }
+ this.l+=size; return o;
+}
+
+function CheckField(hexstr, fld) {
+ var b = this.slice(this.l, this.l+hexstr.length/2);
+ var m = b.hexlify ? b.hexlify() : __hexlify(b);
+ if(m !== hexstr) throw (fld||"") + 'Expected ' + hexstr + ' saw ' + m;
+ this.l += hexstr.length/2;
+}
+
+function WarnField(hexstr, fld) {
+ var b = this.slice(this.l, this.l+hexstr.length/2);
+ var m = b.hexlify ? b.hexlify() : __hexlify(b);
+ if(m !== hexstr) console.error((fld||"") + 'Expected ' + hexstr +' saw ' + m);
+ this.l += hexstr.length/2;
+}
+
+function prep_blob(blob, pos) {
+ blob.read_shift = ReadShift.bind(blob);
+ blob.chk = CheckField;
+ blob.l = pos || 0;
+ var read = ReadShift.bind(blob), chk = CheckField.bind(blob);
+ return [read, chk];
+}
+
+function parsenoop(blob, length) { blob.l += length; }
+/* [MS-XLSB] 2.1.4 Record */
+var recordhopper = function(data, cb) {
+ var tmpbyte, cntbyte;
+ prep_blob(data, data.l || 0);
+ while(data.l < data.length) {
+ var RT = data.read_shift(1);
+ if(RT & 0x80) RT = (RT & 0x7F) + ((data.read_shift(1) & 0x7F)<<7);
+ var R = RecordEnum[RT] || RecordEnum[0xFFFF];
+
+ var length = tmpbyte = data.read_shift(1);
+ for(cntbyte = 1; cntbyte <4 && (tmpbyte & 0x80); ++cntbyte) length += ((tmpbyte = data.read_shift(1)) & 0x7F)<<(7*cntbyte);
+ var d = R.f(data, length);
+ if(cb(d, R)) return;
+ }
+};
+/* [MS-XLSB] 2.1.7.121 */
+var parse_RichStr = function(data, length) {
+ var start = data.l;
+ var flags = data.read_shift(1);
+ var fRichStr = flags & 1, fExtStr = flags & 2;
+ var str = parse_XLWideString(data);
+ z = {
+ t: str,
+ raw:"" + escapexml(str) + "",
+ r: str
+ }
+ if(fRichStr) {
+ /* TODO: formatted string */
+ var dwSizeStrRun = data.read_shift(4);
+ }
+ if(fExtStr) {
+ /* TODO: phonetic string */
+ }
+ data.l = start + length;
+ return z;
+};
+
+/* [MS-XLSB] 2.5.9 */
+function parse_Cell(data) {
+ var col = data.read_shift(4);
+ var iStyleRef = data.read_shift(2);
+ iStyleRef += data.read_shift(1) <<16;
+ var fPhShow = data.read_shift(1);
+ return { c:col };
+}
+
+/* [MS-XLSB] 2.5.21 */
+var parse_CodeName = function(data, length) { return parse_XLWideString(data, length); };
+
+/* [MS-XLSB] 2.5.114 */
+var parse_RelID = function(data, length) { return parse_XLNullableWideString(data, length); };
+
+/* [MS-XLSB] 2.5.122 */
+function parse_RkNumber(data) {
+ var b = data.slice(data.l, data.l+4);
+ var fX100 = b[0] & 1, fInt = b[0] & 2;
+ data.l+=4;
+ b[0] &= ~3;
+ var RK = fInt === 0 ? __readDoubleLE([0,0,0,0,b[0],b[1],b[2],b[3]],0) : __readInt32LE(b,0)>>2;
+ return fX100 ? RK/100 : RK;
+}
+
+/* [MS-XLSB] 2.5.153 */
+var parse_UncheckedRfX = function(data) {
+ var cell = {s: {}, e: {}};
+ cell.s.r = data.read_shift(4);
+ cell.e.r = data.read_shift(4);
+ cell.s.c = data.read_shift(4);
+ cell.e.c = data.read_shift(4);
+ return cell;
+}
+
+/* [MS-XLSB] 2.5.166 */
+var parse_XLNullableWideString = function(data) {
+ var cchCharacters = data.read_shift(4);
+ return cchCharacters === 0 || cchCharacters === 0xFFFFFFFF ? "" : data.read_shift('dbcs', cchCharacters);
+};
+
+/* [MS-XLSB] 2.5.168 */
+var parse_XLWideString = function(data) {
+ var cchCharacters = data.read_shift(4);
+ return cchCharacters === 0 ? "" : data.read_shift('dbcs', cchCharacters);
+};
+
+/* [MS-XLSB] 2.5.171 */
+function parse_Xnum(data, length) { return data.read_shift('ieee754'); }
+
+/* [MS-XLSB] 2.5.198.2 */
+var BErr = {
+ 0x00: "#NULL!",
+ 0x07: "#DIV/0!",
+ 0x0F: "#VALUE!",
+ 0x17: "#REF!",
+ 0x1D: "#NAME?",
+ 0x24: "#NUM!",
+ 0x2A: "#N/A",
+ 0x2B: "#GETTING_DATA",
+ 0xFF: "#WTF?"
+};
+var RBErr = evert(BErr);
+
/* Parse a list of tags */
var parse_rs = (function() {
var tregex = matchtag("t"), rpregex = matchtag("rPr");
@@ -612,33 +919,568 @@ var parse_si = function(x) {
};
/* 18.4 Shared String Table */
-var parse_sst = (function(){
- return function(data) {
- var s = [];
- /* 18.4.9 sst CT_Sst */
- var sst = data.match(new RegExp("]*)>([\\s\\S]*)<\/sst>","m"));
- if(isval(sst)) {
- s = sst[2].replace(//g,"").split(/<\/si>/).map(parse_si);
- sst = parsexmltag(sst[1]); s.Count = sst.count; s.Unique = sst.uniqueCount;
+var parse_sst_xml = function(data) {
+ var s = [];
+ /* 18.4.9 sst CT_Sst */
+ var sst = data.match(new RegExp("]*)>([\\s\\S]*)<\/sst>","m"));
+ if(isval(sst)) {
+ s = sst[2].replace(//g,"").split(/<\/si>/).map(parse_si);
+ sst = parsexmltag(sst[1]); s.Count = sst.count; s.Unique = sst.uniqueCount;
+ }
+ return s;
+};
+
+/* [MS-XLSB] 2.4.219 BrtBeginSst */
+var parse_BrtBeginSst = function(data, length) {
+ return [data.read_shift(4), data.read_shift(4)];
+}
+
+/* [MS-XLSB] 2.1.7.45 Shared Strings */
+var parse_sst_bin = function(data) {
+ var s = [];
+ recordhopper(data, function(val, R) {
+ switch(R.n) {
+ case 'BrtBeginSst': s.Count = val[0]; s.Unique = val[1]; break;
+ case 'BrtSSTItem': s.push(val); break;
+ case 'BrtEndSst': return true;
+ default: throw new Error("Unexpected record " + R.n);
}
- return s;
- };
-})();
+ });
+ return s;
+};
+
+var parse_sst = function(data, name) {
+ return name.substr(-4)===".bin" ? parse_sst_bin(data) : parse_sst_xml(data);
+};
+var styles = {}; // shared styles
+
+/* 18.8.31 numFmts CT_NumFmts */
+function parseNumFmts(t) {
+ styles.NumberFmt = [];
+ for(var y in SSF._table) styles.NumberFmt[y] = SSF._table[y];
+ t[0].match(/<[^>]*>/g).forEach(function(x) {
+ var y = parsexmltag(x);
+ switch(y[0]) {
+ case '': case '': break;
+ case ']*>/g).forEach(function(x) {
+ var y = parsexmltag(x);
+ switch(y[0]) {
+ case '': case '': break;
+
+ /* 18.8.45 xf CT_Xf */
+ case '': break;
+
+ /* 18.8.1 alignment CT_CellAlignment */
+ case '': case '': break;
+
+ case '': break;
+ case ']*)>.*<\/numFmts>/))) parseNumFmts(t);
+
+ /* fonts CT_Fonts ? */
+ /* fills CT_Fills ? */
+ /* borders CT_Borders ? */
+ /* cellStyleXfs CT_CellStyleXfs ? */
+
+ /* cellXfs CT_CellXfs ? */
+ if((t=data.match(/]*)>.*<\/cellXfs>/))) parseCXfs(t);
+
+ /* dxfs CT_Dxfs ? */
+ /* tableStyles CT_TableStyles ? */
+ /* colors CT_Colors ? */
+ /* extLst CT_ExtensionList ? */
+
+ return styles;
+}
+function parse_sty_bin(data) {
+
+}
var ct2type = {
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": "workbooks",
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": "workbooks", /*XLSX*/
"application/vnd.ms-excel.sheet.macroEnabled.main+xml":"workbooks", /*XLSM*/
+ "application/vnd.ms-excel.sheet.binary.macroEnabled.main":"workbooks", /*XLSB*/
+
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":"sheets", /*XLS[XM]*/
+ "application/vnd.ms-excel.worksheet":"sheets", /*XLSB*/
+
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":"styles", /*XLS[XM]*/
+ "application/vnd.ms-excel.styles":"styles", /*XLSB*/
+
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml": "strs", /*XLS[XM]*/
+ "application/vnd.ms-excel.sharedStrings": "strs", /*XLSB*/
+
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml": "calcchains", /*XLS[XM]*/
+ //"application/vnd.ms-excel.calcChain": "calcchains", /*XLSB*/
+
"application/vnd.openxmlformats-package.core-properties+xml": "coreprops",
"application/vnd.openxmlformats-officedocument.extended-properties+xml": "extprops",
- "application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml": "calcchains",
- "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":"sheets",
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml": "strs",
- "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":"styles",
"application/vnd.openxmlformats-officedocument.theme+xml":"themes",
"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml": "comments",
"foo": "bar"
};
+var XMLNS_CT = 'http://schemas.openxmlformats.org/package/2006/content-types';
+
+function parseProps(data) {
+ var p = { Company:'' }, q = {};
+ var strings = ["Application", "DocSecurity", "Company", "AppVersion"];
+ var bools = ["HyperlinksChanged","SharedDoc","LinksUpToDate","ScaleCrop"];
+ var xtra = ["HeadingPairs", "TitlesOfParts"];
+ var xtracp = ["category", "contentStatus", "lastModifiedBy", "lastPrinted", "revision", "version"];
+ var xtradc = ["creator", "description", "identifier", "language", "subject", "title"];
+ var xtradcterms = ["created", "modified"];
+ xtra = xtra.concat(xtracp.map(function(x) { return "cp:" + x; }));
+ xtra = xtra.concat(xtradc.map(function(x) { return "dc:" + x; }));
+ xtra = xtra.concat(xtradcterms.map(function(x) { return "dcterms:" + x; }));
+
+
+ strings.forEach(function(f){p[f] = (data.match(matchtag(f))||[])[1];});
+ bools.forEach(function(f){p[f] = (data.match(matchtag(f))||[])[1] == "true";});
+ xtra.forEach(function(f) {
+ var cur = data.match(new RegExp("<" + f + "[^>]*>(.*)<\/" + f + ">"));
+ if(cur && cur.length > 0) q[f] = cur[1];
+ });
+
+ if(q.HeadingPairs && q.TitlesOfParts) {
+ var v = parseVector(q.HeadingPairs);
+ var j = 0, widx = 0;
+ for(var i = 0; i !== v.length; ++i) {
+ switch(v[i].v) {
+ case "Worksheets": widx = j; p.Worksheets = +(v[++i].v); break;
+ case "Named Ranges": ++i; break; // TODO: Handle Named Ranges
+ }
+ }
+ var parts = parseVector(q.TitlesOfParts).map(function(x) { return utf8read(x.v); });
+ p.SheetNames = parts.slice(widx, widx + p.Worksheets);
+ }
+ p.Creator = q["dc:creator"];
+ p.LastModifiedBy = q["cp:lastModifiedBy"];
+ p.CreatedDate = new Date(q["dcterms:created"]);
+ p.ModifiedDate = new Date(q["dcterms:modified"]);
+ return p;
+}
+
+/* 18.6 Calculation Chain */
+function parseDeps(data) {
+ var d = [];
+ var l = 0, i = 1;
+ (data.match(/<[^>]*>/g)||[]).forEach(function(x) {
+ var y = parsexmltag(x);
+ switch(y[0]) {
+ case '': case '': break;
+ /* 18.6.1 c CT_CalcCell 1 */
+ case ']*>/g)||[]).forEach(function(x) {
+ var y = parsexmltag(x);
+ switch(y[0]) {
+ case ' 0 ? ct.calcchains[0] : "";
+ ct.sst = ct.strs.length > 0 ? ct.strs[0] : "";
+ ct.style = ct.styles.length > 0 ? ct.styles[0] : "";
+ delete ct.calcchains;
+ return ct;
+}
+
+
+
+/* 9.3.2 OPC Relationships Markup */
+function parseRels(data, currentFilePath) {
+ if (!data) return data;
+ if (currentFilePath.charAt(0) !== '/') {
+ currentFilePath = '/'+currentFilePath;
+ }
+ var rels = {};
+
+ var resolveRelativePathIntoAbsolute = function (to) {
+ var toksFrom = currentFilePath.split('/');
+ toksFrom.pop(); // folder path
+ var toksTo = to.split('/');
+ var reversed = [];
+ while (toksTo.length !== 0) {
+ var tokTo = toksTo.shift();
+ if (tokTo === '..') {
+ toksFrom.pop();
+ } else if (tokTo !== '.') {
+ toksFrom.push(tokTo);
+ }
+ }
+ return toksFrom.join('/');
+ }
+
+ data.match(/<[^>]*>/g).forEach(function(x) {
+ var y = parsexmltag(x);
+ /* 9.3.2.2 OPC_Relationships */
+ if (y[0] === '/)) {
+ throw new Error('Not a valid comments xml');
+ }
+ var authors = [];
+ var commentList = [];
+ data.match(/([^\u2603]*)<\/authors>/m)[1].split('').forEach(function(x) {
+ if(x === "" || x.trim() === "") return;
+ authors.push(x.match(/]*>(.*)/)[1]);
+ });
+ data.match(/([^\u2603]*)<\/commentList>/m)[1].split('').forEach(function(x, index) {
+ if(x === "" || x.trim() === "") return;
+ var y = parsexmltag(x.match(/]*>/)[0]);
+ var comment = { author: y.authorId && authors[y.authorId] ? authors[y.authorId] : undefined, ref: y.ref, guid: y.guid };
+ var textMatch = x.match(/([^\u2603]*)<\/text>/m);
+ if (!textMatch || !textMatch[1]) return; // a comment may contain an empty text tag.
+ var rt = parse_si(textMatch[1]);
+ comment.raw = rt.raw;
+ comment.t = rt.t;
+ comment.r = rt.r;
+ commentList.push(comment);
+ });
+ return commentList;
+}
+
+function parseCommentsAddToSheets(zip, dirComments, sheets, sheetRels) {
+ for(var i = 0; i != dirComments.length; ++i) {
+ var canonicalpath=dirComments[i];
+ var comments=parseComments(getdata(getzipfile(zip, canonicalpath.replace(/^\//,''))));
+ // find the sheets targeted by these comments
+ var sheetNames = Object.keys(sheets);
+ for(var j = 0; j != sheetNames.length; ++j) {
+ var sheetName = sheetNames[j];
+ var rels = sheetRels[sheetName];
+ if (rels) {
+ var rel = rels[canonicalpath];
+ if (rel) {
+ insertCommentsIntoSheet(sheetName, sheets[sheetName], comments);
+ }
+ }
+ }
+ }
+}
+
+function insertCommentsIntoSheet(sheetName, sheet, comments) {
+ comments.forEach(function(comment) {
+ var cell = sheet[comment.ref];
+ if (!cell) {
+ cell = {};
+ sheet[comment.ref] = cell;
+ var range = decode_range(sheet["!ref"]);
+ var thisCell = decode_cell(comment.ref);
+ if(range.s.r > thisCell.r) range.s.r = thisCell.r;
+ if(range.e.r < thisCell.r) range.e.r = thisCell.r;
+ if(range.s.c > thisCell.c) range.s.c = thisCell.c;
+ if(range.e.c < thisCell.c) range.e.c = thisCell.c;
+ var encoded = encode_range(range);
+ if (encoded !== sheet["!ref"]) sheet["!ref"] = encoded;
+ }
+
+ if (!cell.c) {
+ cell.c = [];
+ }
+ cell.c.push({a: comment.author, t: comment.t, raw: comment.raw, r: comment.r});
+ });
+}
+
+var strs = {}; // shared strings
+var _ssfopts = {}; // spreadsheet formatting options
+
+/* 18.3 Worksheets */
+function parse_worksheet(data) {
+ if(!data) return data;
+ /* 18.3.1.99 worksheet CT_Worksheet */
+ var s = {};
+
+ /* 18.3.1.35 dimension CT_SheetDimension ? */
+ var ref = data.match(//);
+ if(ref && ref.length == 2 && ref[1].indexOf(":") !== -1) s["!ref"] = ref[1];
+
+ var refguess = {s: {r:1000000, c:1000000}, e: {r:0, c:0} };
+ var q = ["v","f"];
+ var sidx = 0;
+ /* 18.3.1.80 sheetData CT_SheetData ? */
+ if(!data.match(//))
+ data.match(/([^\u2603]*)<\/sheetData>/m)[1].split("").forEach(function(x) {
+ if(x === "" || x.trim() === "") return;
+
+ /* 18.3.1.73 row CT_Row */
+ var row = parsexmltag(x.match(/]*>/)[0]);
+ if(refguess.s.r > row.r - 1) refguess.s.r = row.r - 1;
+ if(refguess.e.r < row.r - 1) refguess.e.r = row.r - 1;
+
+ /* 18.3.1.4 c CT_Cell */
+ var cells = x.substr(x.indexOf('>')+1).split(/ idx) refguess.s.c = idx;
+ if(refguess.e.c < idx) refguess.e.c = idx;
+ var cell = parsexmltag((c.match(/]*>/)||[c])[0]); delete cell[0];
+ var d = c.substr(c.indexOf('>')+1);
+ var p = {};
+ q.forEach(function(f){var x=d.match(matchtag(f));if(x)p[f]=unescapexml(x[1]);});
+
+ /* SCHEMA IS ACTUALLY INCORRECT HERE. IF A CELL HAS NO T, EMIT "" */
+ if(cell.t === undefined && p.v === undefined) { p.t = "str"; p.v = undefined; }
+ else p.t = (cell.t ? cell.t : "n"); // default is "n" in schema
+ switch(p.t) {
+ case 'n': p.v = parseFloat(p.v); break;
+ case 's': {
+ sidx = parseInt(p.v, 10);
+ p.v = strs[sidx].t;
+ p.r = strs[sidx].r;
+ } break;
+ case 'str': if(p.v) p.v = utf8read(p.v); break; // normal string
+ case 'inlineStr':
+ p.t = 'str'; p.v = unescapexml((d.match(matchtag('t'))||["",""])[1]);
+ break; // inline string
+ case 'b':
+ switch(p.v) {
+ case '0': case 'FALSE': case "false": case false: p.v=false; break;
+ case '1': case 'TRUE': case "true": case true: p.v=true; break;
+ default: throw "Unrecognized boolean: " + p.v;
+ } break;
+ /* in case of error, stick value in .raw */
+ case 'e': p.raw = RBErr[p.v]; break;
+ default: throw "Unrecognized cell type: " + p.t;
+ }
+
+ /* formatting */
+ var fmtid = 0;
+ if(cell.s && styles.CellXf) {
+ var cf = styles.CellXf[cell.s];
+ if(cf && cf.numFmtId) fmtid = cf.numFmtId;
+ }
+ p.raw = p.v;
+ p.rawt = p.t;
+ try {
+ p.v = SSF.format(fmtid,p.v,_ssfopts);
+ p.t = 'str';
+ } catch(e) { p.v = p.raw; p.t = p.rawt; }
+
+ s[cell.r] = p;
+ });
+ });
+ if(!s["!ref"]) s["!ref"] = encode_range(refguess);
+ return s;
+}
+
+/* [MS-XLSB] 2.4.718 BrtRowHdr */
+var parse_BrtRowHdr = function(data, length) {
+ var z = {};
+ z.r = data.read_shift(4);
+ data.l += length-4;
+ return z;
+};
+
+/* [MS-XLSB] 2.4.812 BrtWsDim */
+var parse_BrtWsDim = parse_UncheckedRfX;
+
+/* [MS-XLSB] 2.4.815 BrtWsProp */
+var parse_BrtWsProp = function(data, length) {
+ var z = {};
+ /* TODO: pull flags */
+ data.l += 19;
+ z.name = parse_CodeName(data, length - 19);
+ return z;
+};
+
+/* [MS-XLSB] 2.4.304 BrtCellBool */
+var parse_BrtCellBool = function(data, length) {
+ var cell = parse_Cell(data);
+ var fBool = data.read_shift(1);
+ return [cell, fBool, 'b'];
+};
+
+/* [MS-XLSB] 2.4.305 BrtCellError */
+var parse_BrtCellError = function(data, length) {
+ var cell = parse_Cell(data);
+ var fBool = data.read_shift(1);
+ return [cell, fBool, 'e'];
+};
+
+/* [MS-XLSB] 2.4.308 BrtCellIsst */
+var parse_BrtCellIsst = function(data, length) {
+ var cell = parse_Cell(data);
+ var isst = data.read_shift(4);
+ return [cell, isst, 's'];
+};
+
+/* [MS-XLSB] 2.4.310 BrtCellReal */
+var parse_BrtCellReal = function(data, length) {
+ var cell = parse_Cell(data);
+ var value = parse_Xnum(data);
+ return [cell, value, 'n'];
+};
+
+/* [MS-XLSB] 2.4.311 BrtCellRk */
+var parse_BrtCellRk = function(data, length) {
+ var cell = parse_Cell(data);
+ var value = parse_RkNumber(data);
+ return [cell, value, 'n'];
+};
+
+/* [MS-XLSB] 2.4.311 BrtCellRk */
+var parse_BrtCellSt = function(data, length) {
+ var cell = parse_Cell(data);
+ var value = parse_XLWideString(data);
+ return [cell, value, 'str'];
+};
+
+/* [MS-XLSB] 2.4.648 BrtCellError */
+var parse_BrtCellError = function(data, length) {
+ var cell = parse_Cell(data);
+ var fBool = data.read_shift(1);
+ return [cell, fBool, 'e'];
+};
+
+/* [MS-XLSB] 2.4.649 BrtFmlaNum */
+var parse_BrtFmlaNum = function(data, length) {
+ var cell = parse_Cell(data);
+ var value = parse_Xnum(data);
+ data.l += length-16;
+ return [cell, value, 'n' /*, formula */];
+};
+
+var parse_BrtCellBlank = parsenoop;
+var parse_BrtFmlaError = parsenoop;
+var parse_BrtFmlaBool = parsenoop;
+var parse_BrtFmlaString = parsenoop;
+
+/* [MS-XLSB] 2.1.7.61 Worksheet */
+var parse_ws_bin = function(data) {
+ if(!data) return data;
+ var s = {};
+
+ var ref;
+
+ var pass = false;
+ var row, p;
+ recordhopper(data, function(val, R) {
+ switch(R.n) {
+ case 'BrtWsDim': ref = val; break;
+
+ case 'BrtRowHdr':
+ row = val;
+ break; // TODO
+
+ case 'BrtFmlaError': break; // TODO
+ case 'BrtFmlaString': break; // TODO
+ case 'BrtFmlaBool': break; // TODO
+ case 'BrtFmlaNum':
+ case 'BrtCellBool':
+ case 'BrtCellError':
+ case 'BrtCellIsst':
+ case 'BrtCellReal':
+ case 'BrtCellRk':
+ p = {t:val[2]};
+ switch(val[2]) {
+ case 'n': p.v = val[1]; break;
+ case 's': p.v = strs[val[1]].t; p.r = strs[val[1]].r; break;
+ case 'b': p.v = val[1] ? true : false; break;
+ case 'e': p.raw = val[1]; p.v = BErr[p.raw]; break;
+ case 'str': if(p.v) p.v = utf8read(p.v); break;
+ }
+ if(val[3]) p.f = val[3];
+ s[encode_cell({c:val[0].c,r:row.r})] = p;
+ break; // TODO
+
+ case 'BrtCellBlank': break; // (blank cell)
+
+ case 'BrtFmt': break; // TODO
+ case 'BrtArrFmla': break; // TODO
+ case 'BrtShrFmla': break; // TODO
+ case 'BrtBeginSheet': break;
+ case 'BrtWsProp': break; // TODO
+ case 'BrtSheetCalcProp': break; // TODO
+ case 'BrtBeginWsViews': break; // TODO
+ case 'BrtBeginWsView': break; // TODO
+ case 'BrtEndWsView': break; // TODO
+ case 'BrtEndWsViews': break; // TODO
+ case 'BrtSel': break; // TODO
+ case 'BrtACBegin': break; // TODO
+ case 'BrtACEnd': break; // TODO
+ case 'BrtWsFmtInfoEx14': break; // TODO
+ case 'BrtWsFmtInfo': break; // TODO
+ case 'BrtBeginColInfos': break; // TODO
+ case 'BrtColInfo': break; // TODO
+ case 'BrtEndColInfos': break; // TODO
+ case 'BrtBeginSheetData': break; // TODO
+ case 'BrtEndSheetData': break; // TODO
+ case 'BrtSheetProtection': break; // TODO
+ case 'BrtPrintOptions': break; // TODO
+ case 'BrtMargins': break; // TODO
+ case 'BrtPageSetup': break; // TODO
+ case 'BrtFRTBegin': pass = true; break; // TODO
+ case 'BrtFRTEnd': pass = false; break; // TODO
+ case 'BrtEndSheet': break; // TODO
+ //default: if(!pass) throw new Error("Unexpected record " + R.n);
+ }
+ });
+ s["!ref"] = encode_range(ref);
+ return s;
+};
+
/* 18.2.28 (CT_WorkbookProtection) Defaults */
var WBPropsDef = {
allowRefreshQuery: '0',
@@ -716,182 +1558,10 @@ var CustomWBViewDef = {
xWindow: '0',
yWindow: '0'
};
-
-var XMLNS_CT = 'http://schemas.openxmlformats.org/package/2006/content-types';
var XMLNS_WB = 'http://schemas.openxmlformats.org/spreadsheetml/2006/main';
-var strs = {}; // shared strings
-var styles = {}; // shared styles
-var _ssfopts = {}; // spreadsheet formatting options
-
-/* 18.3 Worksheets */
-function parseSheet(data) {
- if(!data) return data;
- /* 18.3.1.99 worksheet CT_Worksheet */
- var s = {};
-
- /* 18.3.1.35 dimension CT_SheetDimension ? */
- var ref = data.match(//);
- if(ref && ref.length == 2 && ref[1].indexOf(":") !== -1) s["!ref"] = ref[1];
-
- var refguess = {s: {r:1000000, c:1000000}, e: {r:0, c:0} };
- var q = ["v","f"];
- var sidx = 0;
- /* 18.3.1.80 sheetData CT_SheetData ? */
- if(!data.match(//))
- data.match(/([^\u2603]*)<\/sheetData>/m)[1].split("
").forEach(function(x) {
- if(x === "" || x.trim() === "") return;
-
- /* 18.3.1.73 row CT_Row */
- var row = parsexmltag(x.match(/]*>/)[0]);
- if(refguess.s.r > row.r - 1) refguess.s.r = row.r - 1;
- if(refguess.e.r < row.r - 1) refguess.e.r = row.r - 1;
-
- /* 18.3.1.4 c CT_Cell */
- var cells = x.substr(x.indexOf('>')+1).split(/ idx) refguess.s.c = idx;
- if(refguess.e.c < idx) refguess.e.c = idx;
- var cell = parsexmltag((c.match(/]*>/)||[c])[0]); delete cell[0];
- var d = c.substr(c.indexOf('>')+1);
- var p = {};
- q.forEach(function(f){var x=d.match(matchtag(f));if(x)p[f]=unescapexml(x[1]);});
-
- /* SCHEMA IS ACTUALLY INCORRECT HERE. IF A CELL HAS NO T, EMIT "" */
- if(cell.t === undefined && p.v === undefined) { p.t = "str"; p.v = undefined; }
- else p.t = (cell.t ? cell.t : "n"); // default is "n" in schema
- switch(p.t) {
- case 'n': p.v = parseFloat(p.v); break;
- case 's': {
- sidx = parseInt(p.v, 10);
- p.v = strs[sidx].t;
- p.r = strs[sidx].r;
- } break;
- case 'str': if(p.v) p.v = utf8read(p.v); break; // normal string
- case 'inlineStr':
- p.t = 'str'; p.v = unescapexml((d.match(matchtag('t'))||["",""])[1]);
- break; // inline string
- case 'b':
- switch(p.v) {
- case '0': case 'FALSE': case "false": case false: p.v=false; break;
- case '1': case 'TRUE': case "true": case true: p.v=true; break;
- default: throw "Unrecognized boolean: " + p.v;
- } break;
- /* in case of error, stick value in .raw */
- case 'e': p.raw = p.v; p.v = undefined; break;
- default: throw "Unrecognized cell type: " + p.t;
- }
-
- /* formatting */
- var fmtid = 0;
- if(cell.s && styles.CellXf) {
- var cf = styles.CellXf[cell.s];
- if(cf && cf.numFmtId) fmtid = cf.numFmtId;
- }
- p.raw = p.v;
- p.rawt = p.t;
- try {
- p.v = SSF.format(fmtid,p.v,_ssfopts);
- p.t = 'str';
- } catch(e) { p.v = p.raw; p.t = p.rawt; }
-
- s[cell.r] = p;
- });
- });
- if(!s["!ref"]) s["!ref"] = encode_range(refguess);
- return s;
-}
-
-function parseProps(data) {
- var p = { Company:'' }, q = {};
- var strings = ["Application", "DocSecurity", "Company", "AppVersion"];
- var bools = ["HyperlinksChanged","SharedDoc","LinksUpToDate","ScaleCrop"];
- var xtra = ["HeadingPairs", "TitlesOfParts"];
- var xtracp = ["category", "contentStatus", "lastModifiedBy", "lastPrinted", "revision", "version"];
- var xtradc = ["creator", "description", "identifier", "language", "subject", "title"];
- var xtradcterms = ["created", "modified"];
- xtra = xtra.concat(xtracp.map(function(x) { return "cp:" + x; }));
- xtra = xtra.concat(xtradc.map(function(x) { return "dc:" + x; }));
- xtra = xtra.concat(xtradcterms.map(function(x) { return "dcterms:" + x; }));
-
-
- strings.forEach(function(f){p[f] = (data.match(matchtag(f))||[])[1];});
- bools.forEach(function(f){p[f] = (data.match(matchtag(f))||[])[1] == "true";});
- xtra.forEach(function(f) {
- var cur = data.match(new RegExp("<" + f + "[^>]*>(.*)<\/" + f + ">"));
- if(cur && cur.length > 0) q[f] = cur[1];
- });
-
- if(q.HeadingPairs && q.TitlesOfParts) {
- var v = parseVector(q.HeadingPairs);
- var j = 0, widx = 0;
- for(var i = 0; i !== v.length; ++i) {
- switch(v[i].v) {
- case "Worksheets": widx = j; p.Worksheets = +v[++i]; break;
- case "Named Ranges": ++i; break; // TODO: Handle Named Ranges
- }
- }
- var parts = parseVector(q.TitlesOfParts).map(utf8read);
- p.SheetNames = parts.slice(widx, widx + p.Worksheets);
- }
- p.Creator = q["dc:creator"];
- p.LastModifiedBy = q["cp:lastModifiedBy"];
- p.CreatedDate = new Date(q["dcterms:created"]);
- p.ModifiedDate = new Date(q["dcterms:modified"]);
- return p;
-}
-
-/* 18.6 Calculation Chain */
-function parseDeps(data) {
- var d = [];
- var l = 0, i = 1;
- (data.match(/<[^>]*>/g)||[]).forEach(function(x) {
- var y = parsexmltag(x);
- switch(y[0]) {
- case '': case '': break;
- /* 18.6.1 c CT_CalcCell 1 */
- case ']*>/g)||[]).forEach(function(x) {
- var y = parsexmltag(x);
- switch(y[0]) {
- case ' 0 ? ct.calcchains[0] : "";
- ct.sst = ct.strs.length > 0 ? ct.strs[0] : "";
- ct.style = ct.styles.length > 0 ? ct.styles[0] : "";
- delete ct.calcchains;
- return ct;
-}
-
-
/* 18.2 Workbook */
-function parseWB(data) {
+function parse_workbook(data) {
var wb = { AppVersion:{}, WBProps:{}, WBView:[], Sheets:[], CalcPr:{}, xmlns: "" };
var pass = false;
data.match(/<[^>]*>/g).forEach(function(x) {
@@ -1007,211 +1677,915 @@ function parseWB(data) {
return wb;
}
-/* 18.8.31 numFmts CT_NumFmts */
-function parseNumFmts(t) {
- styles.NumberFmt = [];
- for(var y in SSF._table) styles.NumberFmt[y] = SSF._table[y];
- t[0].match(/<[^>]*>/g).forEach(function(x) {
- var y = parsexmltag(x);
- switch(y[0]) {
- case '': case '': break;
- case ']*>/g).forEach(function(x) {
- var y = parsexmltag(x);
- switch(y[0]) {
- case '': case '
': break;
+/* [MS-XLSB] 2.1.7.60 Workbook */
+var parse_wb_bin = function(data) {
+ var wb = { AppVersion:{}, WBProps:{}, WBView:[], Sheets:[], CalcPr:{}, xmlns: "" };
+ var pass = false;
- /* 18.8.45 xf CT_Xf */
- case '': break;
+ recordhopper(data, function(val, R) {
+ switch(R.n) {
+ case 'BrtBundleSh': wb.Sheets.push(val); break;
- /* 18.8.1 alignment CT_CellAlignment */
- case '': case '': break;
-
- case '': break;
- case ']*)>.*<\/numFmts>/))) parseNumFmts(t);
-
- /* fonts CT_Fonts ? */
- /* fills CT_Fills ? */
- /* borders CT_Borders ? */
- /* cellStyleXfs CT_CellStyleXfs ? */
-
- /* cellXfs CT_CellXfs ? */
- if((t=data.match(/]*)>.*<\/cellXfs>/))) parseCXfs(t);
-
- /* dxfs CT_Dxfs ? */
- /* tableStyles CT_TableStyles ? */
- /* colors CT_Colors ? */
- /* extLst CT_ExtensionList ? */
-
- return styles;
-}
-
-/* 9.3.2 OPC Relationships Markup */
-function parseRels(data, currentFilePath) {
- if (!data) return data;
- if (currentFilePath.charAt(0) !== '/') {
- currentFilePath = '/'+currentFilePath;
- }
- var rels = {};
-
- var resolveRelativePathIntoAbsolute = function (to) {
- var toksFrom = currentFilePath.split('/');
- toksFrom.pop(); // folder path
- var toksTo = to.split('/');
- var reversed = [];
- while (toksTo.length !== 0) {
- var tokTo = toksTo.shift();
- if (tokTo === '..') {
- toksFrom.pop();
- } else if (tokTo !== '.') {
- toksFrom.push(tokTo);
- }
- }
- return toksFrom.join('/');
- }
-
- data.match(/<[^>]*>/g).forEach(function(x) {
- var y = parsexmltag(x);
- /* 9.3.2.2 OPC_Relationships */
- if (y[0] === '/)) {
- throw new Error('Not a valid comments xml');
- }
- var authors = [];
- var commentList = [];
- data.match(/([^\u2603]*)<\/authors>/m)[1].split('').forEach(function(x) {
- if(x === "" || x.trim() === "") return;
- authors.push(x.match(/]*>(.*)/)[1]);
- });
- data.match(/([^\u2603]*)<\/commentList>/m)[1].split('').forEach(function(x, index) {
- if(x === "" || x.trim() === "") return;
- var y = parsexmltag(x.match(/]*>/)[0]);
- var comment = { author: y.authorId && authors[y.authorId] ? authors[y.authorId] : undefined, ref: y.ref, guid: y.guid };
- var textMatch = x.match(/([^\u2603]*)<\/text>/m);
- if (!textMatch || !textMatch[1]) return; // a comment may contain an empty text tag.
- var rt = parse_si(textMatch[1]);
- comment.raw = rt.raw;
- comment.t = rt.t;
- comment.r = rt.r;
- commentList.push(comment);
- });
- return commentList;
+function parse_ws(data, name) {
+ return name.substr(-4)===".bin" ? parse_ws_bin(data) : parse_worksheet(data);
}
-function parseCommentsAddToSheets(zip, dirComments, sheets, sheetRels) {
- for(var i = 0; i != dirComments.length; ++i) {
- var canonicalpath=dirComments[i];
- var comments=parseComments(getdata(getzipfile(zip, canonicalpath.replace(/^\//,''))));
- // find the sheets targeted by these comments
- var sheetNames = Object.keys(sheets);
- for(var j = 0; j != sheetNames.length; ++j) {
- var sheetName = sheetNames[j];
- var rels = sheetRels[sheetName];
- if (rels) {
- var rel = rels[canonicalpath];
- if (rel) {
- insertCommentsIntoSheet(sheetName, sheets[sheetName], comments);
- }
- }
- }
- }
-}
-
-function insertCommentsIntoSheet(sheetName, sheet, comments) {
- comments.forEach(function(comment) {
- var cell = sheet[comment.ref];
- if (!cell) {
- cell = {};
- sheet[comment.ref] = cell;
- var range = decode_range(sheet["!ref"]);
- var thisCell = decode_cell(comment.ref);
- if(range.s.r > thisCell.r) range.s.r = thisCell.r;
- if(range.e.r < thisCell.r) range.e.r = thisCell.r;
- if(range.s.c > thisCell.c) range.s.c = thisCell.c;
- if(range.e.c < thisCell.c) range.e.c = thisCell.c;
- var encoded = encode_range(range);
- if (encoded !== sheet["!ref"]) sheet["!ref"] = encoded;
- }
-
- if (!cell.c) {
- cell.c = [];
- }
- cell.c.push({a: comment.author, t: comment.t, raw: comment.raw, r: comment.r});
- });
-}
-
-function getdata(data) {
- if(!data) return null;
- if(data.data) return data.data;
- if(data._data && data._data.getContent) return Array.prototype.slice.call(data._data.getContent(),0).map(function(x) { return String.fromCharCode(x); }).join("");
- return null;
-}
-
-function getzipfile(zip, file) {
- var f = file; if(zip.files[f]) return zip.files[f];
- f = file.toLowerCase(); if(zip.files[f]) return zip.files[f];
- f = f.replace(/\//g,'\\'); if(zip.files[f]) return zip.files[f];
- throw new Error("Cannot find file " + file + " in zip");
+function parse_sty(data, name) {
+ return name.substr(-4)===".bin" ? parse_sty_bin(data) : parse_styles(data);
}
+/* [MS-XLSB] 2.3 Record Enumeration */
+var RecordEnum = {
+ 0x0000: { n:"BrtRowHdr", f:parse_BrtRowHdr },
+ 0x0001: { n:"BrtCellBlank", f:parse_BrtCellBlank },
+ 0x0002: { n:"BrtCellRk", f:parse_BrtCellRk },
+ 0x0003: { n:"BrtCellError", f:parse_BrtCellError },
+ 0x0004: { n:"BrtCellBool", f:parse_BrtCellBool },
+ 0x0005: { n:"BrtCellReal", f:parse_BrtCellReal },
+ 0x0006: { n:"BrtCellSt", f:parse_BrtCellSt },
+ 0x0007: { n:"BrtCellIsst", f:parse_BrtCellIsst },
+ 0x0008: { n:"BrtFmlaString", f:parse_BrtFmlaString },
+ 0x0009: { n:"BrtFmlaNum", f:parse_BrtFmlaNum },
+ 0x000A: { n:"BrtFmlaBool", f:parse_BrtFmlaBool },
+ 0x000B: { n:"BrtFmlaError", f:parse_BrtFmlaError },
+ 0x0013: { n:"BrtSSTItem", f:parse_RichStr },
+ 0x0014: { n:"BrtPCDIMissing", f:parsenoop },
+ 0x0015: { n:"BrtPCDINumber", f:parsenoop },
+ 0x0016: { n:"BrtPCDIBoolean", f:parsenoop },
+ 0x0017: { n:"BrtPCDIError", f:parsenoop },
+ 0x0018: { n:"BrtPCDIString", f:parsenoop },
+ 0x0019: { n:"BrtPCDIDatetime", f:parsenoop },
+ 0x001A: { n:"BrtPCDIIndex", f:parsenoop },
+ 0x001B: { n:"BrtPCDIAMissing", f:parsenoop },
+ 0x001C: { n:"BrtPCDIANumber", f:parsenoop },
+ 0x001D: { n:"BrtPCDIABoolean", f:parsenoop },
+ 0x001E: { n:"BrtPCDIAError", f:parsenoop },
+ 0x001F: { n:"BrtPCDIAString", f:parsenoop },
+ 0x0020: { n:"BrtPCDIADatetime", f:parsenoop },
+ 0x0021: { n:"BrtPCRRecord", f:parsenoop },
+ 0x0022: { n:"BrtPCRRecordDt", f:parsenoop },
+ 0x0023: { n:"BrtFRTBegin", f:parsenoop },
+ 0x0024: { n:"BrtFRTEnd", f:parsenoop },
+ 0x0025: { n:"BrtACBegin", f:parsenoop },
+ 0x0026: { n:"BrtACEnd", f:parsenoop },
+ 0x0027: { n:"BrtName", f:parsenoop },
+ 0x0028: { n:"BrtIndexRowBlock", f:parsenoop },
+ 0x002A: { n:"BrtIndexBlock", f:parsenoop },
+ 0x002B: { n:"BrtFont", f:parsenoop },
+ 0x002C: { n:"BrtFmt", f:parsenoop },
+ 0x002D: { n:"BrtFill", f:parsenoop },
+ 0x002E: { n:"BrtBorder", f:parsenoop },
+ 0x002F: { n:"BrtXF", f:parsenoop },
+ 0x0030: { n:"BrtStyle", f:parsenoop },
+ 0x0031: { n:"BrtCellMeta", f:parsenoop },
+ 0x0032: { n:"BrtValueMeta", f:parsenoop },
+ 0x0033: { n:"BrtMdb", f:parsenoop },
+ 0x0034: { n:"BrtBeginFmd", f:parsenoop },
+ 0x0035: { n:"BrtEndFmd", f:parsenoop },
+ 0x0036: { n:"BrtBeginMdx", f:parsenoop },
+ 0x0037: { n:"BrtEndMdx", f:parsenoop },
+ 0x0038: { n:"BrtBeginMdxTuple", f:parsenoop },
+ 0x0039: { n:"BrtEndMdxTuple", f:parsenoop },
+ 0x003A: { n:"BrtMdxMbrIstr", f:parsenoop },
+ 0x003B: { n:"BrtStr", f:parsenoop },
+ 0x003C: { n:"BrtColInfo", f:parsenoop },
+ 0x003E: { n:"BrtCellRString", f:parsenoop },
+ 0x0040: { n:"BrtDVal", f:parsenoop },
+ 0x0041: { n:"BrtSxvcellNum", f:parsenoop },
+ 0x0042: { n:"BrtSxvcellStr", f:parsenoop },
+ 0x0043: { n:"BrtSxvcellBool", f:parsenoop },
+ 0x0044: { n:"BrtSxvcellErr", f:parsenoop },
+ 0x0045: { n:"BrtSxvcellDate", f:parsenoop },
+ 0x0046: { n:"BrtSxvcellNil", f:parsenoop },
+ 0x0080: { n:"BrtFileVersion", f:parsenoop },
+ 0x0081: { n:"BrtBeginSheet", f:parsenoop },
+ 0x0082: { n:"BrtEndSheet", f:parsenoop },
+ 0x0083: { n:"BrtBeginBook", f:parsenoop },
+ 0x0084: { n:"BrtEndBook", f:parsenoop },
+ 0x0085: { n:"BrtBeginWsViews", f:parsenoop },
+ 0x0086: { n:"BrtEndWsViews", f:parsenoop },
+ 0x0087: { n:"BrtBeginBookViews", f:parsenoop },
+ 0x0088: { n:"BrtEndBookViews", f:parsenoop },
+ 0x0089: { n:"BrtBeginWsView", f:parsenoop },
+ 0x008A: { n:"BrtEndWsView", f:parsenoop },
+ 0x008B: { n:"BrtBeginCsViews", f:parsenoop },
+ 0x008C: { n:"BrtEndCsViews", f:parsenoop },
+ 0x008D: { n:"BrtBeginCsView", f:parsenoop },
+ 0x008E: { n:"BrtEndCsView", f:parsenoop },
+ 0x008F: { n:"BrtBeginBundleShs", f:parsenoop },
+ 0x0090: { n:"BrtEndBundleShs", f:parsenoop },
+ 0x0091: { n:"BrtBeginSheetData", f:parsenoop },
+ 0x0092: { n:"BrtEndSheetData", f:parsenoop },
+ 0x0093: { n:"BrtWsProp", f:parse_BrtWsProp },
+ 0x0094: { n:"BrtWsDim", f:parse_BrtWsDim },
+ 0x0097: { n:"BrtPane", f:parsenoop },
+ 0x0098: { n:"BrtSel", f:parsenoop },
+ 0x0099: { n:"BrtWbProp", f:parsenoop },
+ 0x009A: { n:"BrtWbFactoid", f:parsenoop },
+ 0x009B: { n:"BrtFileRecover", f:parsenoop },
+ 0x009C: { n:"BrtBundleSh", f:parse_BrtBundleSh },
+ 0x009D: { n:"BrtCalcProp", f:parsenoop },
+ 0x009E: { n:"BrtBookView", f:parsenoop },
+ 0x009F: { n:"BrtBeginSst", f:parse_BrtBeginSst },
+ 0x00A0: { n:"BrtEndSst", f:parsenoop },
+ 0x00A1: { n:"BrtBeginAFilter", f:parsenoop },
+ 0x00A2: { n:"BrtEndAFilter", f:parsenoop },
+ 0x00A3: { n:"BrtBeginFilterColumn", f:parsenoop },
+ 0x00A4: { n:"BrtEndFilterColumn", f:parsenoop },
+ 0x00A5: { n:"BrtBeginFilters", f:parsenoop },
+ 0x00A6: { n:"BrtEndFilters", f:parsenoop },
+ 0x00A7: { n:"BrtFilter", f:parsenoop },
+ 0x00A8: { n:"BrtColorFilter", f:parsenoop },
+ 0x00A9: { n:"BrtIconFilter", f:parsenoop },
+ 0x00AA: { n:"BrtTop10Filter", f:parsenoop },
+ 0x00AB: { n:"BrtDynamicFilter", f:parsenoop },
+ 0x00AC: { n:"BrtBeginCustomFilters", f:parsenoop },
+ 0x00AD: { n:"BrtEndCustomFilters", f:parsenoop },
+ 0x00AE: { n:"BrtCustomFilter", f:parsenoop },
+ 0x00AF: { n:"BrtAFilterDateGroupItem", f:parsenoop },
+ 0x00B0: { n:"BrtMergeCell", f:parsenoop },
+ 0x00B1: { n:"BrtBeginMergeCells", f:parsenoop },
+ 0x00B2: { n:"BrtEndMergeCells", f:parsenoop },
+ 0x00B3: { n:"BrtBeginPivotCacheDef", f:parsenoop },
+ 0x00B4: { n:"BrtEndPivotCacheDef", f:parsenoop },
+ 0x00B5: { n:"BrtBeginPCDFields", f:parsenoop },
+ 0x00B6: { n:"BrtEndPCDFields", f:parsenoop },
+ 0x00B7: { n:"BrtBeginPCDField", f:parsenoop },
+ 0x00B8: { n:"BrtEndPCDField", f:parsenoop },
+ 0x00B9: { n:"BrtBeginPCDSource", f:parsenoop },
+ 0x00BA: { n:"BrtEndPCDSource", f:parsenoop },
+ 0x00BB: { n:"BrtBeginPCDSRange", f:parsenoop },
+ 0x00BC: { n:"BrtEndPCDSRange", f:parsenoop },
+ 0x00BD: { n:"BrtBeginPCDFAtbl", f:parsenoop },
+ 0x00BE: { n:"BrtEndPCDFAtbl", f:parsenoop },
+ 0x00BF: { n:"BrtBeginPCDIRun", f:parsenoop },
+ 0x00C0: { n:"BrtEndPCDIRun", f:parsenoop },
+ 0x00C1: { n:"BrtBeginPivotCacheRecords", f:parsenoop },
+ 0x00C2: { n:"BrtEndPivotCacheRecords", f:parsenoop },
+ 0x00C3: { n:"BrtBeginPCDHierarchies", f:parsenoop },
+ 0x00C4: { n:"BrtEndPCDHierarchies", f:parsenoop },
+ 0x00C5: { n:"BrtBeginPCDHierarchy", f:parsenoop },
+ 0x00C6: { n:"BrtEndPCDHierarchy", f:parsenoop },
+ 0x00C7: { n:"BrtBeginPCDHFieldsUsage", f:parsenoop },
+ 0x00C8: { n:"BrtEndPCDHFieldsUsage", f:parsenoop },
+ 0x00C9: { n:"BrtBeginExtConnection", f:parsenoop },
+ 0x00CA: { n:"BrtEndExtConnection", f:parsenoop },
+ 0x00CB: { n:"BrtBeginECDbProps", f:parsenoop },
+ 0x00CC: { n:"BrtEndECDbProps", f:parsenoop },
+ 0x00CD: { n:"BrtBeginECOlapProps", f:parsenoop },
+ 0x00CE: { n:"BrtEndECOlapProps", f:parsenoop },
+ 0x00CF: { n:"BrtBeginPCDSConsol", f:parsenoop },
+ 0x00D0: { n:"BrtEndPCDSConsol", f:parsenoop },
+ 0x00D1: { n:"BrtBeginPCDSCPages", f:parsenoop },
+ 0x00D2: { n:"BrtEndPCDSCPages", f:parsenoop },
+ 0x00D3: { n:"BrtBeginPCDSCPage", f:parsenoop },
+ 0x00D4: { n:"BrtEndPCDSCPage", f:parsenoop },
+ 0x00D5: { n:"BrtBeginPCDSCPItem", f:parsenoop },
+ 0x00D6: { n:"BrtEndPCDSCPItem", f:parsenoop },
+ 0x00D7: { n:"BrtBeginPCDSCSets", f:parsenoop },
+ 0x00D8: { n:"BrtEndPCDSCSets", f:parsenoop },
+ 0x00D9: { n:"BrtBeginPCDSCSet", f:parsenoop },
+ 0x00DA: { n:"BrtEndPCDSCSet", f:parsenoop },
+ 0x00DB: { n:"BrtBeginPCDFGroup", f:parsenoop },
+ 0x00DC: { n:"BrtEndPCDFGroup", f:parsenoop },
+ 0x00DD: { n:"BrtBeginPCDFGItems", f:parsenoop },
+ 0x00DE: { n:"BrtEndPCDFGItems", f:parsenoop },
+ 0x00DF: { n:"BrtBeginPCDFGRange", f:parsenoop },
+ 0x00E0: { n:"BrtEndPCDFGRange", f:parsenoop },
+ 0x00E1: { n:"BrtBeginPCDFGDiscrete", f:parsenoop },
+ 0x00E2: { n:"BrtEndPCDFGDiscrete", f:parsenoop },
+ 0x00E3: { n:"BrtBeginPCDSDTupleCache", f:parsenoop },
+ 0x00E4: { n:"BrtEndPCDSDTupleCache", f:parsenoop },
+ 0x00E5: { n:"BrtBeginPCDSDTCEntries", f:parsenoop },
+ 0x00E6: { n:"BrtEndPCDSDTCEntries", f:parsenoop },
+ 0x00E7: { n:"BrtBeginPCDSDTCEMembers", f:parsenoop },
+ 0x00E8: { n:"BrtEndPCDSDTCEMembers", f:parsenoop },
+ 0x00E9: { n:"BrtBeginPCDSDTCEMember", f:parsenoop },
+ 0x00EA: { n:"BrtEndPCDSDTCEMember", f:parsenoop },
+ 0x00EB: { n:"BrtBeginPCDSDTCQueries", f:parsenoop },
+ 0x00EC: { n:"BrtEndPCDSDTCQueries", f:parsenoop },
+ 0x00ED: { n:"BrtBeginPCDSDTCQuery", f:parsenoop },
+ 0x00EE: { n:"BrtEndPCDSDTCQuery", f:parsenoop },
+ 0x00EF: { n:"BrtBeginPCDSDTCSets", f:parsenoop },
+ 0x00F0: { n:"BrtEndPCDSDTCSets", f:parsenoop },
+ 0x00F1: { n:"BrtBeginPCDSDTCSet", f:parsenoop },
+ 0x00F2: { n:"BrtEndPCDSDTCSet", f:parsenoop },
+ 0x00F3: { n:"BrtBeginPCDCalcItems", f:parsenoop },
+ 0x00F4: { n:"BrtEndPCDCalcItems", f:parsenoop },
+ 0x00F5: { n:"BrtBeginPCDCalcItem", f:parsenoop },
+ 0x00F6: { n:"BrtEndPCDCalcItem", f:parsenoop },
+ 0x00F7: { n:"BrtBeginPRule", f:parsenoop },
+ 0x00F8: { n:"BrtEndPRule", f:parsenoop },
+ 0x00F9: { n:"BrtBeginPRFilters", f:parsenoop },
+ 0x00FA: { n:"BrtEndPRFilters", f:parsenoop },
+ 0x00FB: { n:"BrtBeginPRFilter", f:parsenoop },
+ 0x00FC: { n:"BrtEndPRFilter", f:parsenoop },
+ 0x00FD: { n:"BrtBeginPNames", f:parsenoop },
+ 0x00FE: { n:"BrtEndPNames", f:parsenoop },
+ 0x00FF: { n:"BrtBeginPName", f:parsenoop },
+ 0x0100: { n:"BrtEndPName", f:parsenoop },
+ 0x0101: { n:"BrtBeginPNPairs", f:parsenoop },
+ 0x0102: { n:"BrtEndPNPairs", f:parsenoop },
+ 0x0103: { n:"BrtBeginPNPair", f:parsenoop },
+ 0x0104: { n:"BrtEndPNPair", f:parsenoop },
+ 0x0105: { n:"BrtBeginECWebProps", f:parsenoop },
+ 0x0106: { n:"BrtEndECWebProps", f:parsenoop },
+ 0x0107: { n:"BrtBeginEcWpTables", f:parsenoop },
+ 0x0108: { n:"BrtEndECWPTables", f:parsenoop },
+ 0x0109: { n:"BrtBeginECParams", f:parsenoop },
+ 0x010A: { n:"BrtEndECParams", f:parsenoop },
+ 0x010B: { n:"BrtBeginECParam", f:parsenoop },
+ 0x010C: { n:"BrtEndECParam", f:parsenoop },
+ 0x010D: { n:"BrtBeginPCDKPIs", f:parsenoop },
+ 0x010E: { n:"BrtEndPCDKPIs", f:parsenoop },
+ 0x010F: { n:"BrtBeginPCDKPI", f:parsenoop },
+ 0x0110: { n:"BrtEndPCDKPI", f:parsenoop },
+ 0x0111: { n:"BrtBeginDims", f:parsenoop },
+ 0x0112: { n:"BrtEndDims", f:parsenoop },
+ 0x0113: { n:"BrtBeginDim", f:parsenoop },
+ 0x0114: { n:"BrtEndDim", f:parsenoop },
+ 0x0115: { n:"BrtIndexPartEnd", f:parsenoop },
+ 0x0116: { n:"BrtBeginStyleSheet", f:parsenoop },
+ 0x0117: { n:"BrtEndStyleSheet", f:parsenoop },
+ 0x0118: { n:"BrtBeginSXView", f:parsenoop },
+ 0x0119: { n:"BrtEndSXVI", f:parsenoop },
+ 0x011A: { n:"BrtBeginSXVI", f:parsenoop },
+ 0x011B: { n:"BrtBeginSXVIs", f:parsenoop },
+ 0x011C: { n:"BrtEndSXVIs", f:parsenoop },
+ 0x011D: { n:"BrtBeginSXVD", f:parsenoop },
+ 0x011E: { n:"BrtEndSXVD", f:parsenoop },
+ 0x011F: { n:"BrtBeginSXVDs", f:parsenoop },
+ 0x0120: { n:"BrtEndSXVDs", f:parsenoop },
+ 0x0121: { n:"BrtBeginSXPI", f:parsenoop },
+ 0x0122: { n:"BrtEndSXPI", f:parsenoop },
+ 0x0123: { n:"BrtBeginSXPIs", f:parsenoop },
+ 0x0124: { n:"BrtEndSXPIs", f:parsenoop },
+ 0x0125: { n:"BrtBeginSXDI", f:parsenoop },
+ 0x0126: { n:"BrtEndSXDI", f:parsenoop },
+ 0x0127: { n:"BrtBeginSXDIs", f:parsenoop },
+ 0x0128: { n:"BrtEndSXDIs", f:parsenoop },
+ 0x0129: { n:"BrtBeginSXLI", f:parsenoop },
+ 0x012A: { n:"BrtEndSXLI", f:parsenoop },
+ 0x012B: { n:"BrtBeginSXLIRws", f:parsenoop },
+ 0x012C: { n:"BrtEndSXLIRws", f:parsenoop },
+ 0x012D: { n:"BrtBeginSXLICols", f:parsenoop },
+ 0x012E: { n:"BrtEndSXLICols", f:parsenoop },
+ 0x012F: { n:"BrtBeginSXFormat", f:parsenoop },
+ 0x0130: { n:"BrtEndSXFormat", f:parsenoop },
+ 0x0131: { n:"BrtBeginSXFormats", f:parsenoop },
+ 0x0132: { n:"BrtEndSxFormats", f:parsenoop },
+ 0x0133: { n:"BrtBeginSxSelect", f:parsenoop },
+ 0x0134: { n:"BrtEndSxSelect", f:parsenoop },
+ 0x0135: { n:"BrtBeginISXVDRws", f:parsenoop },
+ 0x0136: { n:"BrtEndISXVDRws", f:parsenoop },
+ 0x0137: { n:"BrtBeginISXVDCols", f:parsenoop },
+ 0x0138: { n:"BrtEndISXVDCols", f:parsenoop },
+ 0x0139: { n:"BrtEndSXLocation", f:parsenoop },
+ 0x013A: { n:"BrtBeginSXLocation", f:parsenoop },
+ 0x013B: { n:"BrtEndSXView", f:parsenoop },
+ 0x013C: { n:"BrtBeginSXTHs", f:parsenoop },
+ 0x013D: { n:"BrtEndSXTHs", f:parsenoop },
+ 0x013E: { n:"BrtBeginSXTH", f:parsenoop },
+ 0x013F: { n:"BrtEndSXTH", f:parsenoop },
+ 0x0140: { n:"BrtBeginISXTHRws", f:parsenoop },
+ 0x0141: { n:"BrtEndISXTHRws", f:parsenoop },
+ 0x0142: { n:"BrtBeginISXTHCols", f:parsenoop },
+ 0x0143: { n:"BrtEndISXTHCols", f:parsenoop },
+ 0x0144: { n:"BrtBeginSXTDMPS", f:parsenoop },
+ 0x0145: { n:"BrtEndSXTDMPs", f:parsenoop },
+ 0x0146: { n:"BrtBeginSXTDMP", f:parsenoop },
+ 0x0147: { n:"BrtEndSXTDMP", f:parsenoop },
+ 0x0148: { n:"BrtBeginSXTHItems", f:parsenoop },
+ 0x0149: { n:"BrtEndSXTHItems", f:parsenoop },
+ 0x014A: { n:"BrtBeginSXTHItem", f:parsenoop },
+ 0x014B: { n:"BrtEndSXTHItem", f:parsenoop },
+ 0x014C: { n:"BrtBeginMetadata", f:parsenoop },
+ 0x014D: { n:"BrtEndMetadata", f:parsenoop },
+ 0x014E: { n:"BrtBeginEsmdtinfo", f:parsenoop },
+ 0x014F: { n:"BrtMdtinfo", f:parsenoop },
+ 0x0150: { n:"BrtEndEsmdtinfo", f:parsenoop },
+ 0x0151: { n:"BrtBeginEsmdb", f:parsenoop },
+ 0x0152: { n:"BrtEndEsmdb", f:parsenoop },
+ 0x0153: { n:"BrtBeginEsfmd", f:parsenoop },
+ 0x0154: { n:"BrtEndEsfmd", f:parsenoop },
+ 0x0155: { n:"BrtBeginSingleCells", f:parsenoop },
+ 0x0156: { n:"BrtEndSingleCells", f:parsenoop },
+ 0x0157: { n:"BrtBeginList", f:parsenoop },
+ 0x0158: { n:"BrtEndList", f:parsenoop },
+ 0x0159: { n:"BrtBeginListCols", f:parsenoop },
+ 0x015A: { n:"BrtEndListCols", f:parsenoop },
+ 0x015B: { n:"BrtBeginListCol", f:parsenoop },
+ 0x015C: { n:"BrtEndListCol", f:parsenoop },
+ 0x015D: { n:"BrtBeginListXmlCPr", f:parsenoop },
+ 0x015E: { n:"BrtEndListXmlCPr", f:parsenoop },
+ 0x015F: { n:"BrtListCCFmla", f:parsenoop },
+ 0x0160: { n:"BrtListTrFmla", f:parsenoop },
+ 0x0161: { n:"BrtBeginExternals", f:parsenoop },
+ 0x0162: { n:"BrtEndExternals", f:parsenoop },
+ 0x0163: { n:"BrtSupBookSrc", f:parsenoop },
+ 0x0165: { n:"BrtSupSelf", f:parsenoop },
+ 0x0166: { n:"BrtSupSame", f:parsenoop },
+ 0x0167: { n:"BrtSupTabs", f:parsenoop },
+ 0x0168: { n:"BrtBeginSupBook", f:parsenoop },
+ 0x0169: { n:"BrtPlaceholderName", f:parsenoop },
+ 0x016A: { n:"BrtExternSheet", f:parsenoop },
+ 0x016B: { n:"BrtExternTableStart", f:parsenoop },
+ 0x016C: { n:"BrtExternTableEnd", f:parsenoop },
+ 0x016E: { n:"BrtExternRowHdr", f:parsenoop },
+ 0x016F: { n:"BrtExternCellBlank", f:parsenoop },
+ 0x0170: { n:"BrtExternCellReal", f:parsenoop },
+ 0x0171: { n:"BrtExternCellBool", f:parsenoop },
+ 0x0172: { n:"BrtExternCellError", f:parsenoop },
+ 0x0173: { n:"BrtExternCellString", f:parsenoop },
+ 0x0174: { n:"BrtBeginEsmdx", f:parsenoop },
+ 0x0175: { n:"BrtEndEsmdx", f:parsenoop },
+ 0x0176: { n:"BrtBeginMdxSet", f:parsenoop },
+ 0x0177: { n:"BrtEndMdxSet", f:parsenoop },
+ 0x0178: { n:"BrtBeginMdxMbrProp", f:parsenoop },
+ 0x0179: { n:"BrtEndMdxMbrProp", f:parsenoop },
+ 0x017A: { n:"BrtBeginMdxKPI", f:parsenoop },
+ 0x017B: { n:"BrtEndMdxKPI", f:parsenoop },
+ 0x017C: { n:"BrtBeginEsstr", f:parsenoop },
+ 0x017D: { n:"BrtEndEsstr", f:parsenoop },
+ 0x017E: { n:"BrtBeginPRFItem", f:parsenoop },
+ 0x017F: { n:"BrtEndPRFItem", f:parsenoop },
+ 0x0180: { n:"BrtBeginPivotCacheIDs", f:parsenoop },
+ 0x0181: { n:"BrtEndPivotCacheIDs", f:parsenoop },
+ 0x0182: { n:"BrtBeginPivotCacheID", f:parsenoop },
+ 0x0183: { n:"BrtEndPivotCacheID", f:parsenoop },
+ 0x0184: { n:"BrtBeginISXVIs", f:parsenoop },
+ 0x0185: { n:"BrtEndISXVIs", f:parsenoop },
+ 0x0186: { n:"BrtBeginColInfos", f:parsenoop },
+ 0x0187: { n:"BrtEndColInfos", f:parsenoop },
+ 0x0188: { n:"BrtBeginRwBrk", f:parsenoop },
+ 0x0189: { n:"BrtEndRwBrk", f:parsenoop },
+ 0x018A: { n:"BrtBeginColBrk", f:parsenoop },
+ 0x018B: { n:"BrtEndColBrk", f:parsenoop },
+ 0x018C: { n:"BrtBrk", f:parsenoop },
+ 0x018D: { n:"BrtUserBookView", f:parsenoop },
+ 0x018E: { n:"BrtInfo", f:parsenoop },
+ 0x018F: { n:"BrtCUsr", f:parsenoop },
+ 0x0190: { n:"BrtUsr", f:parsenoop },
+ 0x0191: { n:"BrtBeginUsers", f:parsenoop },
+ 0x0193: { n:"BrtEOF", f:parsenoop },
+ 0x0194: { n:"BrtUCR", f:parsenoop },
+ 0x0195: { n:"BrtRRInsDel", f:parsenoop },
+ 0x0196: { n:"BrtRREndInsDel", f:parsenoop },
+ 0x0197: { n:"BrtRRMove", f:parsenoop },
+ 0x0198: { n:"BrtRREndMove", f:parsenoop },
+ 0x0199: { n:"BrtRRChgCell", f:parsenoop },
+ 0x019A: { n:"BrtRREndChgCell", f:parsenoop },
+ 0x019B: { n:"BrtRRHeader", f:parsenoop },
+ 0x019C: { n:"BrtRRUserView", f:parsenoop },
+ 0x019D: { n:"BrtRRRenSheet", f:parsenoop },
+ 0x019E: { n:"BrtRRInsertSh", f:parsenoop },
+ 0x019F: { n:"BrtRRDefName", f:parsenoop },
+ 0x01A0: { n:"BrtRRNote", f:parsenoop },
+ 0x01A1: { n:"BrtRRConflict", f:parsenoop },
+ 0x01A2: { n:"BrtRRTQSIF", f:parsenoop },
+ 0x01A3: { n:"BrtRRFormat", f:parsenoop },
+ 0x01A4: { n:"BrtRREndFormat", f:parsenoop },
+ 0x01A5: { n:"BrtRRAutoFmt", f:parsenoop },
+ 0x01A6: { n:"BrtBeginUserShViews", f:parsenoop },
+ 0x01A7: { n:"BrtBeginUserShView", f:parsenoop },
+ 0x01A8: { n:"BrtEndUserShView", f:parsenoop },
+ 0x01A9: { n:"BrtEndUserShViews", f:parsenoop },
+ 0x01AA: { n:"BrtArrFmla", f:parsenoop },
+ 0x01AB: { n:"BrtShrFmla", f:parsenoop },
+ 0x01AC: { n:"BrtTable", f:parsenoop },
+ 0x01AD: { n:"BrtBeginExtConnections", f:parsenoop },
+ 0x01AE: { n:"BrtEndExtConnections", f:parsenoop },
+ 0x01AF: { n:"BrtBeginPCDCalcMems", f:parsenoop },
+ 0x01B0: { n:"BrtEndPCDCalcMems", f:parsenoop },
+ 0x01B1: { n:"BrtBeginPCDCalcMem", f:parsenoop },
+ 0x01B2: { n:"BrtEndPCDCalcMem", f:parsenoop },
+ 0x01B3: { n:"BrtBeginPCDHGLevels", f:parsenoop },
+ 0x01B4: { n:"BrtEndPCDHGLevels", f:parsenoop },
+ 0x01B5: { n:"BrtBeginPCDHGLevel", f:parsenoop },
+ 0x01B6: { n:"BrtEndPCDHGLevel", f:parsenoop },
+ 0x01B7: { n:"BrtBeginPCDHGLGroups", f:parsenoop },
+ 0x01B8: { n:"BrtEndPCDHGLGroups", f:parsenoop },
+ 0x01B9: { n:"BrtBeginPCDHGLGroup", f:parsenoop },
+ 0x01BA: { n:"BrtEndPCDHGLGroup", f:parsenoop },
+ 0x01BB: { n:"BrtBeginPCDHGLGMembers", f:parsenoop },
+ 0x01BC: { n:"BrtEndPCDHGLGMembers", f:parsenoop },
+ 0x01BD: { n:"BrtBeginPCDHGLGMember", f:parsenoop },
+ 0x01BE: { n:"BrtEndPCDHGLGMember", f:parsenoop },
+ 0x01BF: { n:"BrtBeginQSI", f:parsenoop },
+ 0x01C0: { n:"BrtEndQSI", f:parsenoop },
+ 0x01C1: { n:"BrtBeginQSIR", f:parsenoop },
+ 0x01C2: { n:"BrtEndQSIR", f:parsenoop },
+ 0x01C3: { n:"BrtBeginDeletedNames", f:parsenoop },
+ 0x01C4: { n:"BrtEndDeletedNames", f:parsenoop },
+ 0x01C5: { n:"BrtBeginDeletedName", f:parsenoop },
+ 0x01C6: { n:"BrtEndDeletedName", f:parsenoop },
+ 0x01C7: { n:"BrtBeginQSIFs", f:parsenoop },
+ 0x01C8: { n:"BrtEndQSIFs", f:parsenoop },
+ 0x01C9: { n:"BrtBeginQSIF", f:parsenoop },
+ 0x01CA: { n:"BrtEndQSIF", f:parsenoop },
+ 0x01CB: { n:"BrtBeginAutoSortScope", f:parsenoop },
+ 0x01CC: { n:"BrtEndAutoSortScope", f:parsenoop },
+ 0x01CD: { n:"BrtBeginConditionalFormatting", f:parsenoop },
+ 0x01CE: { n:"BrtEndConditionalFormatting", f:parsenoop },
+ 0x01CF: { n:"BrtBeginCFRule", f:parsenoop },
+ 0x01D0: { n:"BrtEndCFRule", f:parsenoop },
+ 0x01D1: { n:"BrtBeginIconSet", f:parsenoop },
+ 0x01D2: { n:"BrtEndIconSet", f:parsenoop },
+ 0x01D3: { n:"BrtBeginDatabar", f:parsenoop },
+ 0x01D4: { n:"BrtEndDatabar", f:parsenoop },
+ 0x01D5: { n:"BrtBeginColorScale", f:parsenoop },
+ 0x01D6: { n:"BrtEndColorScale", f:parsenoop },
+ 0x01D7: { n:"BrtCFVO", f:parsenoop },
+ 0x01D8: { n:"BrtExternValueMeta", f:parsenoop },
+ 0x01D9: { n:"BrtBeginColorPalette", f:parsenoop },
+ 0x01DA: { n:"BrtEndColorPalette", f:parsenoop },
+ 0x01DB: { n:"BrtIndexedColor", f:parsenoop },
+ 0x01DC: { n:"BrtMargins", f:parsenoop },
+ 0x01DD: { n:"BrtPrintOptions", f:parsenoop },
+ 0x01DE: { n:"BrtPageSetup", f:parsenoop },
+ 0x01DF: { n:"BrtBeginHeaderFooter", f:parsenoop },
+ 0x01E0: { n:"BrtEndHeaderFooter", f:parsenoop },
+ 0x01E1: { n:"BrtBeginSXCrtFormat", f:parsenoop },
+ 0x01E2: { n:"BrtEndSXCrtFormat", f:parsenoop },
+ 0x01E3: { n:"BrtBeginSXCrtFormats", f:parsenoop },
+ 0x01E4: { n:"BrtEndSXCrtFormats", f:parsenoop },
+ 0x01E5: { n:"BrtWsFmtInfo", f:parsenoop },
+ 0x01E6: { n:"BrtBeginMgs", f:parsenoop },
+ 0x01E7: { n:"BrtEndMGs", f:parsenoop },
+ 0x01E8: { n:"BrtBeginMGMaps", f:parsenoop },
+ 0x01E9: { n:"BrtEndMGMaps", f:parsenoop },
+ 0x01EA: { n:"BrtBeginMG", f:parsenoop },
+ 0x01EB: { n:"BrtEndMG", f:parsenoop },
+ 0x01EC: { n:"BrtBeginMap", f:parsenoop },
+ 0x01ED: { n:"BrtEndMap", f:parsenoop },
+ 0x01EE: { n:"BrtHLink", f:parsenoop },
+ 0x01EF: { n:"BrtBeginDCon", f:parsenoop },
+ 0x01F0: { n:"BrtEndDCon", f:parsenoop },
+ 0x01F1: { n:"BrtBeginDRefs", f:parsenoop },
+ 0x01F2: { n:"BrtEndDRefs", f:parsenoop },
+ 0x01F3: { n:"BrtDRef", f:parsenoop },
+ 0x01F4: { n:"BrtBeginScenMan", f:parsenoop },
+ 0x01F5: { n:"BrtEndScenMan", f:parsenoop },
+ 0x01F6: { n:"BrtBeginSct", f:parsenoop },
+ 0x01F7: { n:"BrtEndSct", f:parsenoop },
+ 0x01F8: { n:"BrtSlc", f:parsenoop },
+ 0x01F9: { n:"BrtBeginDXFs", f:parsenoop },
+ 0x01FA: { n:"BrtEndDXFs", f:parsenoop },
+ 0x01FB: { n:"BrtDXF", f:parsenoop },
+ 0x01FC: { n:"BrtBeginTableStyles", f:parsenoop },
+ 0x01FD: { n:"BrtEndTableStyles", f:parsenoop },
+ 0x01FE: { n:"BrtBeginTableStyle", f:parsenoop },
+ 0x01FF: { n:"BrtEndTableStyle", f:parsenoop },
+ 0x0200: { n:"BrtTableStyleElement", f:parsenoop },
+ 0x0201: { n:"BrtTableStyleClient", f:parsenoop },
+ 0x0202: { n:"BrtBeginVolDeps", f:parsenoop },
+ 0x0203: { n:"BrtEndVolDeps", f:parsenoop },
+ 0x0204: { n:"BrtBeginVolType", f:parsenoop },
+ 0x0205: { n:"BrtEndVolType", f:parsenoop },
+ 0x0206: { n:"BrtBeginVolMain", f:parsenoop },
+ 0x0207: { n:"BrtEndVolMain", f:parsenoop },
+ 0x0208: { n:"BrtBeginVolTopic", f:parsenoop },
+ 0x0209: { n:"BrtEndVolTopic", f:parsenoop },
+ 0x020A: { n:"BrtVolSubtopic", f:parsenoop },
+ 0x020B: { n:"BrtVolRef", f:parsenoop },
+ 0x020C: { n:"BrtVolNum", f:parsenoop },
+ 0x020D: { n:"BrtVolErr", f:parsenoop },
+ 0x020E: { n:"BrtVolStr", f:parsenoop },
+ 0x020F: { n:"BrtVolBool", f:parsenoop },
+ 0x0212: { n:"BrtBeginSortState", f:parsenoop },
+ 0x0213: { n:"BrtEndSortState", f:parsenoop },
+ 0x0214: { n:"BrtBeginSortCond", f:parsenoop },
+ 0x0215: { n:"BrtEndSortCond", f:parsenoop },
+ 0x0216: { n:"BrtBookProtection", f:parsenoop },
+ 0x0217: { n:"BrtSheetProtection", f:parsenoop },
+ 0x0218: { n:"BrtRangeProtection", f:parsenoop },
+ 0x0219: { n:"BrtPhoneticInfo", f:parsenoop },
+ 0x021A: { n:"BrtBeginECTxtWiz", f:parsenoop },
+ 0x021B: { n:"BrtEndECTxtWiz", f:parsenoop },
+ 0x021C: { n:"BrtBeginECTWFldInfoLst", f:parsenoop },
+ 0x021D: { n:"BrtEndECTWFldInfoLst", f:parsenoop },
+ 0x021E: { n:"BrtBeginECTwFldInfo", f:parsenoop },
+ 0x0224: { n:"BrtFileSharing", f:parsenoop },
+ 0x0225: { n:"BrtOleSize", f:parsenoop },
+ 0x0226: { n:"BrtDrawing", f:parsenoop },
+ 0x0227: { n:"BrtLegacyDrawing", f:parsenoop },
+ 0x0228: { n:"BrtLegacyDrawingHF", f:parsenoop },
+ 0x0229: { n:"BrtWebOpt", f:parsenoop },
+ 0x022A: { n:"BrtBeginWebPubItems", f:parsenoop },
+ 0x022B: { n:"BrtEndWebPubItems", f:parsenoop },
+ 0x022C: { n:"BrtBeginWebPubItem", f:parsenoop },
+ 0x022D: { n:"BrtEndWebPubItem", f:parsenoop },
+ 0x022E: { n:"BrtBeginSXCondFmt", f:parsenoop },
+ 0x022F: { n:"BrtEndSXCondFmt", f:parsenoop },
+ 0x0230: { n:"BrtBeginSXCondFmts", f:parsenoop },
+ 0x0231: { n:"BrtEndSXCondFmts", f:parsenoop },
+ 0x0232: { n:"BrtBkHim", f:parsenoop },
+ 0x0234: { n:"BrtColor", f:parsenoop },
+ 0x0235: { n:"BrtBeginIndexedColors", f:parsenoop },
+ 0x0236: { n:"BrtEndIndexedColors", f:parsenoop },
+ 0x0239: { n:"BrtBeginMRUColors", f:parsenoop },
+ 0x023A: { n:"BrtEndMRUColors", f:parsenoop },
+ 0x023C: { n:"BrtMRUColor", f:parsenoop },
+ 0x023D: { n:"BrtBeginDVals", f:parsenoop },
+ 0x023E: { n:"BrtEndDVals", f:parsenoop },
+ 0x0241: { n:"BrtSupNameStart", f:parsenoop },
+ 0x0242: { n:"BrtSupNameValueStart", f:parsenoop },
+ 0x0243: { n:"BrtSupNameValueEnd", f:parsenoop },
+ 0x0244: { n:"BrtSupNameNum", f:parsenoop },
+ 0x0245: { n:"BrtSupNameErr", f:parsenoop },
+ 0x0246: { n:"BrtSupNameSt", f:parsenoop },
+ 0x0247: { n:"BrtSupNameNil", f:parsenoop },
+ 0x0248: { n:"BrtSupNameBool", f:parsenoop },
+ 0x0249: { n:"BrtSupNameFmla", f:parsenoop },
+ 0x024A: { n:"BrtSupNameBits", f:parsenoop },
+ 0x024B: { n:"BrtSupNameEnd", f:parsenoop },
+ 0x024C: { n:"BrtEndSupBook", f:parsenoop },
+ 0x024D: { n:"BrtCellSmartTagProperty", f:parsenoop },
+ 0x024E: { n:"BrtBeginCellSmartTag", f:parsenoop },
+ 0x024F: { n:"BrtEndCellSmartTag", f:parsenoop },
+ 0x0250: { n:"BrtBeginCellSmartTags", f:parsenoop },
+ 0x0251: { n:"BrtEndCellSmartTags", f:parsenoop },
+ 0x0252: { n:"BrtBeginSmartTags", f:parsenoop },
+ 0x0253: { n:"BrtEndSmartTags", f:parsenoop },
+ 0x0254: { n:"BrtSmartTagType", f:parsenoop },
+ 0x0255: { n:"BrtBeginSmartTagTypes", f:parsenoop },
+ 0x0256: { n:"BrtEndSmartTagTypes", f:parsenoop },
+ 0x0257: { n:"BrtBeginSXFilters", f:parsenoop },
+ 0x0258: { n:"BrtEndSXFilters", f:parsenoop },
+ 0x0259: { n:"BrtBeginSXFILTER", f:parsenoop },
+ 0x025A: { n:"BrtEndSXFilter", f:parsenoop },
+ 0x025B: { n:"BrtBeginFills", f:parsenoop },
+ 0x025C: { n:"BrtEndFills", f:parsenoop },
+ 0x025D: { n:"BrtBeginCellWatches", f:parsenoop },
+ 0x025E: { n:"BrtEndCellWatches", f:parsenoop },
+ 0x025F: { n:"BrtCellWatch", f:parsenoop },
+ 0x0260: { n:"BrtBeginCRErrs", f:parsenoop },
+ 0x0261: { n:"BrtEndCRErrs", f:parsenoop },
+ 0x0262: { n:"BrtCrashRecErr", f:parsenoop },
+ 0x0263: { n:"BrtBeginFonts", f:parsenoop },
+ 0x0264: { n:"BrtEndFonts", f:parsenoop },
+ 0x0265: { n:"BrtBeginBorders", f:parsenoop },
+ 0x0266: { n:"BrtEndBorders", f:parsenoop },
+ 0x0267: { n:"BrtBeginFmts", f:parsenoop },
+ 0x0268: { n:"BrtEndFmts", f:parsenoop },
+ 0x0269: { n:"BrtBeginCellXFs", f:parsenoop },
+ 0x026A: { n:"BrtEndCellXFs", f:parsenoop },
+ 0x026B: { n:"BrtBeginStyles", f:parsenoop },
+ 0x026C: { n:"BrtEndStyles", f:parsenoop },
+ 0x0271: { n:"BrtBigName", f:parsenoop },
+ 0x0272: { n:"BrtBeginCellStyleXFs", f:parsenoop },
+ 0x0273: { n:"BrtEndCellStyleXFs", f:parsenoop },
+ 0x0274: { n:"BrtBeginComments", f:parsenoop },
+ 0x0275: { n:"BrtEndComments", f:parsenoop },
+ 0x0276: { n:"BrtBeginCommentAuthors", f:parsenoop },
+ 0x0277: { n:"BrtEndCommentAuthors", f:parsenoop },
+ 0x0278: { n:"BrtCommentAuthor", f:parsenoop },
+ 0x0279: { n:"BrtBeginCommentList", f:parsenoop },
+ 0x027A: { n:"BrtEndCommentList", f:parsenoop },
+ 0x027B: { n:"BrtBeginComment", f:parsenoop },
+ 0x027C: { n:"BrtEndComment", f:parsenoop },
+ 0x027D: { n:"BrtCommentText", f:parsenoop },
+ 0x027E: { n:"BrtBeginOleObjects", f:parsenoop },
+ 0x027F: { n:"BrtOleObject", f:parsenoop },
+ 0x0280: { n:"BrtEndOleObjects", f:parsenoop },
+ 0x0281: { n:"BrtBeginSxrules", f:parsenoop },
+ 0x0282: { n:"BrtEndSxRules", f:parsenoop },
+ 0x0283: { n:"BrtBeginActiveXControls", f:parsenoop },
+ 0x0284: { n:"BrtActiveX", f:parsenoop },
+ 0x0285: { n:"BrtEndActiveXControls", f:parsenoop },
+ 0x0286: { n:"BrtBeginPCDSDTCEMembersSortBy", f:parsenoop },
+ 0x0288: { n:"BrtBeginCellIgnoreECs", f:parsenoop },
+ 0x0289: { n:"BrtCellIgnoreEC", f:parsenoop },
+ 0x028A: { n:"BrtEndCellIgnoreECs", f:parsenoop },
+ 0x028B: { n:"BrtCsProp", f:parsenoop },
+ 0x028C: { n:"BrtCsPageSetup", f:parsenoop },
+ 0x028D: { n:"BrtBeginUserCsViews", f:parsenoop },
+ 0x028E: { n:"BrtEndUserCsViews", f:parsenoop },
+ 0x028F: { n:"BrtBeginUserCsView", f:parsenoop },
+ 0x0290: { n:"BrtEndUserCsView", f:parsenoop },
+ 0x0291: { n:"BrtBeginPcdSFCIEntries", f:parsenoop },
+ 0x0292: { n:"BrtEndPCDSFCIEntries", f:parsenoop },
+ 0x0293: { n:"BrtPCDSFCIEntry", f:parsenoop },
+ 0x0294: { n:"BrtBeginListParts", f:parsenoop },
+ 0x0295: { n:"BrtListPart", f:parsenoop },
+ 0x0296: { n:"BrtEndListParts", f:parsenoop },
+ 0x0297: { n:"BrtSheetCalcProp", f:parsenoop },
+ 0x0298: { n:"BrtBeginFnGroup", f:parsenoop },
+ 0x0299: { n:"BrtFnGroup", f:parsenoop },
+ 0x029A: { n:"BrtEndFnGroup", f:parsenoop },
+ 0x029B: { n:"BrtSupAddin", f:parsenoop },
+ 0x029C: { n:"BrtSXTDMPOrder", f:parsenoop },
+ 0x029D: { n:"BrtCsProtection", f:parsenoop },
+ 0x029F: { n:"BrtBeginWsSortMap", f:parsenoop },
+ 0x02A0: { n:"BrtEndWsSortMap", f:parsenoop },
+ 0x02A1: { n:"BrtBeginRRSort", f:parsenoop },
+ 0x02A2: { n:"BrtEndRRSort", f:parsenoop },
+ 0x02A3: { n:"BrtRRSortItem", f:parsenoop },
+ 0x02A4: { n:"BrtFileSharingIso", f:parsenoop },
+ 0x02A5: { n:"BrtBookProtectionIso", f:parsenoop },
+ 0x02A6: { n:"BrtSheetProtectionIso", f:parsenoop },
+ 0x02A7: { n:"BrtCsProtectionIso", f:parsenoop },
+ 0x02A8: { n:"BrtRangeProtectionIso", f:parsenoop },
+ 0x0400: { n:"BrtRwDescent", f:parsenoop },
+ 0x0401: { n:"BrtKnownFonts", f:parsenoop },
+ 0x0402: { n:"BrtBeginSXTupleSet", f:parsenoop },
+ 0x0403: { n:"BrtEndSXTupleSet", f:parsenoop },
+ 0x0404: { n:"BrtBeginSXTupleSetHeader", f:parsenoop },
+ 0x0405: { n:"BrtEndSXTupleSetHeader", f:parsenoop },
+ 0x0406: { n:"BrtSXTupleSetHeaderItem", f:parsenoop },
+ 0x0407: { n:"BrtBeginSXTupleSetData", f:parsenoop },
+ 0x0408: { n:"BrtEndSXTupleSetData", f:parsenoop },
+ 0x0409: { n:"BrtBeginSXTupleSetRow", f:parsenoop },
+ 0x040A: { n:"BrtEndSXTupleSetRow", f:parsenoop },
+ 0x040B: { n:"BrtSXTupleSetRowItem", f:parsenoop },
+ 0x040C: { n:"BrtNameExt", f:parsenoop },
+ 0x040D: { n:"BrtPCDH14", f:parsenoop },
+ 0x040E: { n:"BrtBeginPCDCalcMem14", f:parsenoop },
+ 0x040F: { n:"BrtEndPCDCalcMem14", f:parsenoop },
+ 0x0410: { n:"BrtSXTH14", f:parsenoop },
+ 0x0411: { n:"BrtBeginSparklineGroup", f:parsenoop },
+ 0x0412: { n:"BrtEndSparklineGroup", f:parsenoop },
+ 0x0413: { n:"BrtSparkline", f:parsenoop },
+ 0x0414: { n:"BrtSXDI14", f:parsenoop },
+ 0x0415: { n:"BrtWsFmtInfoEx14", f:parsenoop },
+ 0x0416: { n:"BrtBeginConditionalFormatting14", f:parsenoop },
+ 0x0417: { n:"BrtEndConditionalFormatting14", f:parsenoop },
+ 0x0418: { n:"BrtBeginCFRule14", f:parsenoop },
+ 0x0419: { n:"BrtEndCFRule14", f:parsenoop },
+ 0x041A: { n:"BrtCFVO14", f:parsenoop },
+ 0x041B: { n:"BrtBeginDatabar14", f:parsenoop },
+ 0x041C: { n:"BrtBeginIconSet14", f:parsenoop },
+ 0x041D: { n:"BrtDVal14", f:parsenoop },
+ 0x041E: { n:"BrtBeginDVals14", f:parsenoop },
+ 0x041F: { n:"BrtColor14", f:parsenoop },
+ 0x0420: { n:"BrtBeginSparklines", f:parsenoop },
+ 0x0421: { n:"BrtEndSparklines", f:parsenoop },
+ 0x0422: { n:"BrtBeginSparklineGroups", f:parsenoop },
+ 0x0423: { n:"BrtEndSparklineGroups", f:parsenoop },
+ 0x0425: { n:"BrtSXVD14", f:parsenoop },
+ 0x0426: { n:"BrtBeginSxview14", f:parsenoop },
+ 0x0427: { n:"BrtEndSxview14", f:parsenoop },
+ 0x042A: { n:"BrtBeginPCD14", f:parsenoop },
+ 0x042B: { n:"BrtEndPCD14", f:parsenoop },
+ 0x042C: { n:"BrtBeginExtConn14", f:parsenoop },
+ 0x042D: { n:"BrtEndExtConn14", f:parsenoop },
+ 0x042E: { n:"BrtBeginSlicerCacheIDs", f:parsenoop },
+ 0x042F: { n:"BrtEndSlicerCacheIDs", f:parsenoop },
+ 0x0430: { n:"BrtBeginSlicerCacheID", f:parsenoop },
+ 0x0431: { n:"BrtEndSlicerCacheID", f:parsenoop },
+ 0x0433: { n:"BrtBeginSlicerCache", f:parsenoop },
+ 0x0434: { n:"BrtEndSlicerCache", f:parsenoop },
+ 0x0435: { n:"BrtBeginSlicerCacheDef", f:parsenoop },
+ 0x0436: { n:"BrtEndSlicerCacheDef", f:parsenoop },
+ 0x0437: { n:"BrtBeginSlicersEx", f:parsenoop },
+ 0x0438: { n:"BrtEndSlicersEx", f:parsenoop },
+ 0x0439: { n:"BrtBeginSlicerEx", f:parsenoop },
+ 0x043A: { n:"BrtEndSlicerEx", f:parsenoop },
+ 0x043B: { n:"BrtBeginSlicer", f:parsenoop },
+ 0x043C: { n:"BrtEndSlicer", f:parsenoop },
+ 0x043D: { n:"BrtSlicerCachePivotTables", f:parsenoop },
+ 0x043E: { n:"BrtBeginSlicerCacheOlapImpl", f:parsenoop },
+ 0x043F: { n:"BrtEndSlicerCacheOlapImpl", f:parsenoop },
+ 0x0440: { n:"BrtBeginSlicerCacheLevelsData", f:parsenoop },
+ 0x0441: { n:"BrtEndSlicerCacheLevelsData", f:parsenoop },
+ 0x0442: { n:"BrtBeginSlicerCacheLevelData", f:parsenoop },
+ 0x0443: { n:"BrtEndSlicerCacheLevelData", f:parsenoop },
+ 0x0444: { n:"BrtBeginSlicerCacheSiRanges", f:parsenoop },
+ 0x0445: { n:"BrtEndSlicerCacheSiRanges", f:parsenoop },
+ 0x0446: { n:"BrtBeginSlicerCacheSiRange", f:parsenoop },
+ 0x0447: { n:"BrtEndSlicerCacheSiRange", f:parsenoop },
+ 0x0448: { n:"BrtSlicerCacheOlapItem", f:parsenoop },
+ 0x0449: { n:"BrtBeginSlicerCacheSelections", f:parsenoop },
+ 0x044A: { n:"BrtSlicerCacheSelection", f:parsenoop },
+ 0x044B: { n:"BrtEndSlicerCacheSelections", f:parsenoop },
+ 0x044C: { n:"BrtBeginSlicerCacheNative", f:parsenoop },
+ 0x044D: { n:"BrtEndSlicerCacheNative", f:parsenoop },
+ 0x044E: { n:"BrtSlicerCacheNativeItem", f:parsenoop },
+ 0x044F: { n:"BrtRangeProtection14", f:parsenoop },
+ 0x0450: { n:"BrtRangeProtectionIso14", f:parsenoop },
+ 0x0451: { n:"BrtCellIgnoreEC14", f:parsenoop },
+ 0x0457: { n:"BrtList14", f:parsenoop },
+ 0x0458: { n:"BrtCFIcon", f:parsenoop },
+ 0x0459: { n:"BrtBeginSlicerCachesPivotCacheIDs", f:parsenoop },
+ 0x045A: { n:"BrtEndSlicerCachesPivotCacheIDs", f:parsenoop },
+ 0x045B: { n:"BrtBeginSlicers", f:parsenoop },
+ 0x045C: { n:"BrtEndSlicers", f:parsenoop },
+ 0x045D: { n:"BrtWbProp14", f:parsenoop },
+ 0x045E: { n:"BrtBeginSXEdit", f:parsenoop },
+ 0x045F: { n:"BrtEndSXEdit", f:parsenoop },
+ 0x0460: { n:"BrtBeginSXEdits", f:parsenoop },
+ 0x0461: { n:"BrtEndSXEdits", f:parsenoop },
+ 0x0462: { n:"BrtBeginSXChange", f:parsenoop },
+ 0x0463: { n:"BrtEndSXChange", f:parsenoop },
+ 0x0464: { n:"BrtBeginSXChanges", f:parsenoop },
+ 0x0465: { n:"BrtEndSXChanges", f:parsenoop },
+ 0x0466: { n:"BrtSXTupleItems", f:parsenoop },
+ 0x0468: { n:"BrtBeginSlicerStyle", f:parsenoop },
+ 0x0469: { n:"BrtEndSlicerStyle", f:parsenoop },
+ 0x046A: { n:"BrtSlicerStyleElement", f:parsenoop },
+ 0x046B: { n:"BrtBeginStyleSheetExt14", f:parsenoop },
+ 0x046C: { n:"BrtEndStyleSheetExt14", f:parsenoop },
+ 0x046D: { n:"BrtBeginSlicerCachesPivotCacheID", f:parsenoop },
+ 0x046E: { n:"BrtEndSlicerCachesPivotCacheID", f:parsenoop },
+ 0x046F: { n:"BrtBeginConditionalFormattings", f:parsenoop },
+ 0x0470: { n:"BrtEndConditionalFormattings", f:parsenoop },
+ 0x0471: { n:"BrtBeginPCDCalcMemExt", f:parsenoop },
+ 0x0472: { n:"BrtEndPCDCalcMemExt", f:parsenoop },
+ 0x0473: { n:"BrtBeginPCDCalcMemsExt", f:parsenoop },
+ 0x0474: { n:"BrtEndPCDCalcMemsExt", f:parsenoop },
+ 0x0475: { n:"BrtPCDField14", f:parsenoop },
+ 0x0476: { n:"BrtBeginSlicerStyles", f:parsenoop },
+ 0x0477: { n:"BrtEndSlicerStyles", f:parsenoop },
+ 0x0478: { n:"BrtBeginSlicerStyleElements", f:parsenoop },
+ 0x0479: { n:"BrtEndSlicerStyleElements", f:parsenoop },
+ 0x047A: { n:"BrtCFRuleExt", f:parsenoop },
+ 0x047B: { n:"BrtBeginSXCondFmt14", f:parsenoop },
+ 0x047C: { n:"BrtEndSXCondFmt14", f:parsenoop },
+ 0x047D: { n:"BrtBeginSXCondFmts14", f:parsenoop },
+ 0x047E: { n:"BrtEndSXCondFmts14", f:parsenoop },
+ 0x0480: { n:"BrtBeginSortCond14", f:parsenoop },
+ 0x0481: { n:"BrtEndSortCond14", f:parsenoop },
+ 0x0482: { n:"BrtEndDVals14", f:parsenoop },
+ 0x0483: { n:"BrtEndIconSet14", f:parsenoop },
+ 0x0484: { n:"BrtEndDatabar14", f:parsenoop },
+ 0x0485: { n:"BrtBeginColorScale14", f:parsenoop },
+ 0x0486: { n:"BrtEndColorScale14", f:parsenoop },
+ 0x0487: { n:"BrtBeginSxrules14", f:parsenoop },
+ 0x0488: { n:"BrtEndSxrules14", f:parsenoop },
+ 0x0489: { n:"BrtBeginPRule14", f:parsenoop },
+ 0x048A: { n:"BrtEndPRule14", f:parsenoop },
+ 0x048B: { n:"BrtBeginPRFilters14", f:parsenoop },
+ 0x048C: { n:"BrtEndPRFilters14", f:parsenoop },
+ 0x048D: { n:"BrtBeginPRFilter14", f:parsenoop },
+ 0x048E: { n:"BrtEndPRFilter14", f:parsenoop },
+ 0x048F: { n:"BrtBeginPRFItem14", f:parsenoop },
+ 0x0490: { n:"BrtEndPRFItem14", f:parsenoop },
+ 0x0491: { n:"BrtBeginCellIgnoreECs14", f:parsenoop },
+ 0x0492: { n:"BrtEndCellIgnoreECs14", f:parsenoop },
+ 0x0493: { n:"BrtDxf14", f:parsenoop },
+ 0x0494: { n:"BrtBeginDxF14s", f:parsenoop },
+ 0x0495: { n:"BrtEndDxf14s", f:parsenoop },
+ 0x0499: { n:"BrtFilter14", f:parsenoop },
+ 0x049A: { n:"BrtBeginCustomFilters14", f:parsenoop },
+ 0x049C: { n:"BrtCustomFilter14", f:parsenoop },
+ 0x049D: { n:"BrtIconFilter14", f:parsenoop },
+ 0x049E: { n:"BrtPivotCacheConnectionName", f:parsenoop },
+ 0x0800: { n:"BrtBeginDecoupledPivotCacheIDs", f:parsenoop },
+ 0x0801: { n:"BrtEndDecoupledPivotCacheIDs", f:parsenoop },
+ 0x0802: { n:"BrtDecoupledPivotCacheID", f:parsenoop },
+ 0x0803: { n:"BrtBeginPivotTableRefs", f:parsenoop },
+ 0x0804: { n:"BrtEndPivotTableRefs", f:parsenoop },
+ 0x0805: { n:"BrtPivotTableRef", f:parsenoop },
+ 0x0806: { n:"BrtSlicerCacheBookPivotTables", f:parsenoop },
+ 0x0807: { n:"BrtBeginSxvcells", f:parsenoop },
+ 0x0808: { n:"BrtEndSxvcells", f:parsenoop },
+ 0x0809: { n:"BrtBeginSxRow", f:parsenoop },
+ 0x080A: { n:"BrtEndSxRow", f:parsenoop },
+ 0x080C: { n:"BrtPcdCalcMem15", f:parsenoop },
+ 0x0813: { n:"BrtQsi15", f:parsenoop },
+ 0x0814: { n:"BrtBeginWebExtensions", f:parsenoop },
+ 0x0815: { n:"BrtEndWebExtensions", f:parsenoop },
+ 0x0816: { n:"BrtWebExtension", f:parsenoop },
+ 0x0817: { n:"BrtAbsPath15", f:parsenoop },
+ 0x0818: { n:"BrtBeginPivotTableUISettings", f:parsenoop },
+ 0x0819: { n:"BrtEndPivotTableUISettings", f:parsenoop },
+ 0x081B: { n:"BrtTableSlicerCacheIDs", f:parsenoop },
+ 0x081C: { n:"BrtTableSlicerCacheID", f:parsenoop },
+ 0x081D: { n:"BrtBeginTableSlicerCache", f:parsenoop },
+ 0x081E: { n:"BrtEndTableSlicerCache", f:parsenoop },
+ 0x081F: { n:"BrtSxFilter15", f:parsenoop },
+ 0x0820: { n:"BrtBeginTimelineCachePivotCacheIDs", f:parsenoop },
+ 0x0821: { n:"BrtEndTimelineCachePivotCacheIDs", f:parsenoop },
+ 0x0822: { n:"BrtTimelineCachePivotCacheID", f:parsenoop },
+ 0x0823: { n:"BrtBeginTimelineCacheIDs", f:parsenoop },
+ 0x0824: { n:"BrtEndTimelineCacheIDs", f:parsenoop },
+ 0x0825: { n:"BrtBeginTimelineCacheID", f:parsenoop },
+ 0x0826: { n:"BrtEndTimelineCacheID", f:parsenoop },
+ 0x0827: { n:"BrtBeginTimelinesEx", f:parsenoop },
+ 0x0828: { n:"BrtEndTimelinesEx", f:parsenoop },
+ 0x0829: { n:"BrtBeginTimelineEx", f:parsenoop },
+ 0x082A: { n:"BrtEndTimelineEx", f:parsenoop },
+ 0x082B: { n:"BrtWorkBookPr15", f:parsenoop },
+ 0x082C: { n:"BrtPCDH15", f:parsenoop },
+ 0x082D: { n:"BrtBeginTimelineStyle", f:parsenoop },
+ 0x082E: { n:"BrtEndTimelineStyle", f:parsenoop },
+ 0x082F: { n:"BrtTimelineStyleElement", f:parsenoop },
+ 0x0830: { n:"BrtBeginTimelineStylesheetExt15", f:parsenoop },
+ 0x0831: { n:"BrtEndTimelineStylesheetExt15", f:parsenoop },
+ 0x0832: { n:"BrtBeginTimelineStyles", f:parsenoop },
+ 0x0833: { n:"BrtEndTimelineStyles", f:parsenoop },
+ 0x0834: { n:"BrtBeginTimelineStyleElements", f:parsenoop },
+ 0x0835: { n:"BrtEndTimelineStyleElements", f:parsenoop },
+ 0x0836: { n:"BrtDxf15", f:parsenoop },
+ 0x0837: { n:"BrtBeginDxfs15", f:parsenoop },
+ 0x0838: { n:"brtEndDxfs15", f:parsenoop },
+ 0x0839: { n:"BrtSlicerCacheHideItemsWithNoData", f:parsenoop },
+ 0x083A: { n:"BrtBeginItemUniqueNames", f:parsenoop },
+ 0x083B: { n:"BrtEndItemUniqueNames", f:parsenoop },
+ 0x083C: { n:"BrtItemUniqueName", f:parsenoop },
+ 0x083D: { n:"BrtBeginExtConn15", f:parsenoop },
+ 0x083E: { n:"BrtEndExtConn15", f:parsenoop },
+ 0x083F: { n:"BrtBeginOledbPr15", f:parsenoop },
+ 0x0840: { n:"BrtEndOledbPr15", f:parsenoop },
+ 0x0841: { n:"BrtBeginDataFeedPr15", f:parsenoop },
+ 0x0842: { n:"BrtEndDataFeedPr15", f:parsenoop },
+ 0x0843: { n:"BrtTextPr15", f:parsenoop },
+ 0x0844: { n:"BrtRangePr15", f:parsenoop },
+ 0x0845: { n:"BrtDbCommand15", f:parsenoop },
+ 0x0846: { n:"BrtBeginDbTables15", f:parsenoop },
+ 0x0847: { n:"BrtEndDbTables15", f:parsenoop },
+ 0x0848: { n:"BrtDbTable15", f:parsenoop },
+ 0x0849: { n:"BrtBeginDataModel", f:parsenoop },
+ 0x084A: { n:"BrtEndDataModel", f:parsenoop },
+ 0x084B: { n:"BrtBeginModelTables", f:parsenoop },
+ 0x084C: { n:"BrtEndModelTables", f:parsenoop },
+ 0x084D: { n:"BrtModelTable", f:parsenoop },
+ 0x084E: { n:"BrtBeginModelRelationships", f:parsenoop },
+ 0x084F: { n:"BrtEndModelRelationships", f:parsenoop },
+ 0x0850: { n:"BrtModelRelationship", f:parsenoop },
+ 0x0851: { n:"BrtBeginECTxtWiz15", f:parsenoop },
+ 0x0852: { n:"BrtEndECTxtWiz15", f:parsenoop },
+ 0x0853: { n:"BrtBeginECTWFldInfoLst15", f:parsenoop },
+ 0x0854: { n:"BrtEndECTWFldInfoLst15", f:parsenoop },
+ 0x0855: { n:"BrtBeginECTWFldInfo15", f:parsenoop },
+ 0x0856: { n:"BrtFieldListActiveItem", f:parsenoop },
+ 0x0857: { n:"BrtPivotCacheIdVersion", f:parsenoop },
+ 0x0858: { n:"BrtSXDI15", f:parsenoop },
+ 0xFFFF: { n:"", f:parsenoop }
+};
function parseZip(zip) {
var entries = Object.keys(zip.files);
var keys = entries.filter(function(x){return x.substr(-1) != '/';}).sort();
var dir = parseCT(getdata(getzipfile(zip, '[Content_Types].xml')));
- if(dir.workbooks.length === 0) throw new Error("Could not find workbook entry");
+ var xlsb = false;
+ if(dir.workbooks.length === 0) {
+ var binname = "xl/workbook.bin";
+ if(!getzipfile(zip,binname)) throw new Error("Could not find workbook entry");
+ dir.workbooks.push(binname);
+ xlsb = true;
+ }
strs = {};
- if(dir.sst) strs=parse_sst(getdata(getzipfile(zip, dir.sst.replace(/^\//,''))));
+ if(dir.sst) strs=parse_sst(getdata(getzipfile(zip, dir.sst.replace(/^\//,''))), dir.sst);
styles = {};
- if(dir.style) styles = parseStyles(getdata(getzipfile(zip, dir.style.replace(/^\//,''))));
+ if(dir.style) styles = parse_sty(getdata(getzipfile(zip, dir.style.replace(/^\//,''))),dir.style);
- var wb = parseWB(getdata(getzipfile(zip, dir.workbooks[0].replace(/^\//,''))));
+ var wb = parse_wb(getdata(getzipfile(zip, dir.workbooks[0].replace(/^\//,''))), dir.workbooks[0]);
var propdata = dir.coreprops.length !== 0 ? getdata(getzipfile(zip, dir.coreprops[0].replace(/^\//,''))) : "";
propdata += dir.extprops.length !== 0 ? getdata(getzipfile(zip, dir.extprops[0].replace(/^\//,''))) : "";
var props = propdata !== "" ? parseProps(propdata) : {};
var deps = {};
if(dir.calcchain) deps=parseDeps(getdata(getzipfile(zip, dir.calcchain.replace(/^\//,''))));
var sheets = {}, i=0;
- var sheetRels = {};
+ var sheetRels = {};
if(!props.Worksheets) {
/* Google Docs doesn't generate the appropriate metadata, so we impute: */
var wbsheets = wb.Sheets;
@@ -1222,20 +2596,21 @@ function parseZip(zip) {
}
for(i = 0; i != props.Worksheets; ++i) {
try { /* TODO: remove these guards */
- var path = 'xl/worksheets/sheet' + (i+1) + '.xml';
+ var path = 'xl/worksheets/sheet' + (i+1) + (xlsb?'.bin':'.xml');
var relsPath = path.replace(/^(.*)(\/)([^\/]*)$/, "$1/_rels/$3.rels");
- sheets[props.SheetNames[i]]=parseSheet(getdata(getzipfile(zip, path)));
+ sheets[props.SheetNames[i]]=parse_ws(getdata(getzipfile(zip, path)),path);
sheetRels[props.SheetNames[i]]=parseRels(getdata(getzipfile(zip, relsPath)), path);
} catch(e) {}
}
} else {
for(i = 0; i != props.Worksheets; ++i) {
try {
- var path = dir.sheets[i].replace(/^\//,'');
+ //var path = dir.sheets[i].replace(/^\//,'');
+ var path = 'xl/worksheets/sheet' + (i+1) + (xlsb?'.bin':'.xml');
var relsPath = path.replace(/^(.*)(\/)([^\/]*)$/, "$1/_rels/$3.rels");
- sheets[props.SheetNames[i]]=parseSheet(getdata(getzipfile(zip, path)));
+ sheets[props.SheetNames[i]]=parse_ws(getdata(getzipfile(zip, path)),path);
sheetRels[props.SheetNames[i]]=parseRels(getdata(getzipfile(zip, relsPath)), path);
- } catch(e) {}
+ } catch(e) {/*console.error(e);*/}
}
}
@@ -1254,16 +2629,6 @@ function parseZip(zip) {
files: zip.files
};
}
-
-var _fs, jszip;
-if(typeof JSZip !== 'undefined') jszip = JSZip;
-if (typeof exports !== 'undefined') {
- if (typeof module !== 'undefined' && module.exports) {
- if(typeof jszip === 'undefined') jszip = require('./jszip').JSZip;
- _fs = require('fs');
- }
-}
-
function readSync(data, options) {
var zip, d = data;
var o = options||{};
@@ -1349,7 +2714,7 @@ function sheet_to_csv(sheet, opts) {
if(typeof val.v === 'undefined') return "";
return JSON.stringify(val.v);
case 'b': return val.v ? "TRUE" : "FALSE";
- case 'e': return ""; /* throw out value in case of error */
+ case 'e': return val.v; /* throw out value in case of error */
default: throw 'unrecognized type ' + val.t;
}
};