version bump 0.11.10: binary miscellany

- XLSX empty numeric cells stubbed (fixes #891 h/t @mgoku)
- XLS sheet type identification
- XLS/XLSB/XLSM CodeName exposure (fixes #361 h/t @TennisVisuals)
- CFB re-exported
This commit is contained in:
SheetJS 2017-11-19 20:51:14 -05:00
parent 7c7f4a69d4
commit 547fba56a2
39 changed files with 882 additions and 610 deletions

View File

@ -1083,6 +1083,7 @@ may not enforce this constraint.
| Key | Description |
|:----------------|:----------------------------------------------------|
| `CodeName` | [VBA Project Workbook Code Name](#vba-and-macros) |
| `date1904` | epoch: 0/false for 1900 system, 1/true for 1904 |
| `filterPrivacy` | Warn or strip personally identifying info on save |
@ -1443,6 +1444,19 @@ supported in `XLSM`, `XLSB`, and `BIFF8 XLS` formats. The supported format
writers automatically insert the data blobs if it is present in the workbook and
associate with the worksheet names.
<details>
<summary><b>Custom Code Names</b> (click to show)</summary>
The workbook code name is stored in `wb.Workbook.WBProps.CodeName`. By default,
Excel will write `ThisWorkbook` or a translated phrase like `DieseArbeitsmappe`.
Worksheet and Chartsheet code names are in the worksheet properties object at
`wb.Workbook.Sheets[i].CodeName`. Macrosheets and Dialogsheets are ignored.
The readers and writers preserve the code names, but they have to be manually
set when adding a VBA blob to a different workbook.
</details>
<details>
<summary><b>Macrosheets</b> (click to show)</summary>

View File

@ -124,6 +124,7 @@ if(program.all) {
opts.sheetStubs = true;
opts.cellDates = true;
wopts.cellStyles = true;
wopts.bookVBA = true;
}
if(program.sparse) opts.dense = false; else opts.dense = true;
@ -194,6 +195,7 @@ if(!program.quiet && !program.book) console.error(target_sheet);
].forEach(function(m) { if(program[m[0]] || isfmt(m[1])) {
wopts.bookType = m[0];
if(program.book) {
/*:: if(wb == null) throw new Error("Unreachable"); */
wb.SheetNames.forEach(function(n, i) {
wopts.sheet = n;
X.writeFile(wb, (program.output || sheetname || filename || "") + m[1] + "." + i, wopts);
@ -205,7 +207,9 @@ if(!program.quiet && !program.book) console.error(target_sheet);
function outit(o, fn) { if(fn) fs.writeFileSync(fn, o); else console.log(o); }
function doit(cb) {
/*:: if(!wb) throw new Error("unreachable"); */
if(program.book) wb.SheetNames.forEach(function(n, i) {
/*:: if(!wb) throw new Error("unreachable"); */
outit(cb(wb.Sheets[n]), (program.output || sheetname || filename) + "." + i);
});
else outit(cb(ws), program.output);

View File

@ -1 +1 @@
XLSX.version = '0.11.9';
XLSX.version = '0.11.10';

View File

@ -3,14 +3,14 @@ var Base64 = (function make_b64(){
return {
encode: function(input/*:string*/)/*:string*/ {
var o = "";
var c1, c2, c3, e1, e2, e3, e4;
var c1=0, c2=0, c3=0, e1=0, e2=0, e3=0, e4=0;
for(var i = 0; i < input.length; ) {
c1 = input.charCodeAt(i++);
c2 = input.charCodeAt(i++);
c3 = input.charCodeAt(i++);
e1 = c1 >> 2;
e2 = (c1 & 3) << 4 | c2 >> 4;
e3 = (c2 & 15) << 2 | c3 >> 6;
e2 = ((c1 & 3) << 4) | (c2 >> 4);
e3 = ((c2 & 15) << 2) | (c3 >> 6);
e4 = c3 & 63;
if (isNaN(c2)) { e3 = e4 = 64; }
else if (isNaN(c3)) { e4 = 64; }
@ -20,20 +20,20 @@ var Base64 = (function make_b64(){
},
decode: function b64_decode(input/*:string*/)/*:string*/ {
var o = "";
var c1, c2, c3;
var e1, e2, e3, e4;
var c1=0, c2=0, c3=0;
var e1=0, e2=0, e3=0, e4=0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
for(var i = 0; i < input.length;) {
e1 = map.indexOf(input.charAt(i++));
e2 = map.indexOf(input.charAt(i++));
e3 = map.indexOf(input.charAt(i++));
e4 = map.indexOf(input.charAt(i++));
c1 = e1 << 2 | e2 >> 4;
c2 = (e2 & 15) << 4 | e3 >> 2;
c3 = (e3 & 3) << 6 | e4;
c1 = (e1 << 2) | (e2 >> 4);
c2 = ((e2 & 15) << 4) | (e3 >> 2);
c3 = ((e3 & 3) << 6) | e4;
o += String.fromCharCode(c1);
if (e3 != 64) { o += String.fromCharCode(c2); }
if (e4 != 64) { o += String.fromCharCode(c3); }
if (e3 !== 64) { o += String.fromCharCode(c2); }
if (e4 !== 64) { o += String.fromCharCode(c3); }
}
return o;
}

View File

@ -211,6 +211,12 @@ function write_WriteAccess(s/*:string*/, opts) {
return o;
}
/* 2.4.351 */
function parse_WsBool(blob, length, opts) {
var flags = opts && opts.biff == 8 || length == 2 ? blob.read_shift(2) : (blob.l += length, 0);
return { fDialog: flags & 0x10 };
}
/* 2.4.28 */
function parse_BoundSheet8(blob, length, opts) {
var pos = blob.read_shift(4);

View File

@ -8,7 +8,7 @@ var WK_ = (function() {
var R = Enum[RT] || Enum[0xFF];
var length = data.read_shift(2);
var tgt = data.l + length;
var d = R.f(data, length, opts);
var d = (R.f||parsenoop)(data, length, opts);
data.l = tgt;
if(cb(d, R.n, RT)) return;
}
@ -79,7 +79,10 @@ var WK_ = (function() {
sidx = val[3]; n = "Sheet" + (sidx + 1);
snames.push(n);
}
s[encode_cell(val[0])] = val[1];
if(o.dense) {
if(!s[val[0].r]) s[val[0].r] = [];
s[val[0].r][val[0].c] = val[1];
} else s[encode_cell(val[0])] = val[1];
if(refguess.e.c < val[0].c) refguess.e.c = val[0].c;
if(refguess.e.r < val[0].r) refguess.e.r = val[0].r;
break;
@ -227,95 +230,95 @@ var WK_ = (function() {
var WK1Enum = {
/*::[*/0x0000/*::]*/: { n:"BOF", f:parseuint16 },
/*::[*/0x0001/*::]*/: { n:"EOF", f:parsenoop },
/*::[*/0x0002/*::]*/: { n:"CALCMODE", f:parsenoop },
/*::[*/0x0003/*::]*/: { n:"CALCORDER", f:parsenoop },
/*::[*/0x0004/*::]*/: { n:"SPLIT", f:parsenoop },
/*::[*/0x0005/*::]*/: { n:"SYNC", f:parsenoop },
/*::[*/0x0001/*::]*/: { n:"EOF" },
/*::[*/0x0002/*::]*/: { n:"CALCMODE" },
/*::[*/0x0003/*::]*/: { n:"CALCORDER" },
/*::[*/0x0004/*::]*/: { n:"SPLIT" },
/*::[*/0x0005/*::]*/: { n:"SYNC" },
/*::[*/0x0006/*::]*/: { n:"RANGE", f:parse_RANGE },
/*::[*/0x0007/*::]*/: { n:"WINDOW1", f:parsenoop },
/*::[*/0x0008/*::]*/: { n:"COLW1", f:parsenoop },
/*::[*/0x0009/*::]*/: { n:"WINTWO", f:parsenoop },
/*::[*/0x000A/*::]*/: { n:"COLW2", f:parsenoop },
/*::[*/0x000B/*::]*/: { n:"NAME", f:parsenoop },
/*::[*/0x000C/*::]*/: { n:"BLANK", f:parsenoop },
/*::[*/0x0007/*::]*/: { n:"WINDOW1" },
/*::[*/0x0008/*::]*/: { n:"COLW1" },
/*::[*/0x0009/*::]*/: { n:"WINTWO" },
/*::[*/0x000A/*::]*/: { n:"COLW2" },
/*::[*/0x000B/*::]*/: { n:"NAME" },
/*::[*/0x000C/*::]*/: { n:"BLANK" },
/*::[*/0x000D/*::]*/: { n:"INTEGER", f:parse_INTEGER },
/*::[*/0x000E/*::]*/: { n:"NUMBER", f:parse_NUMBER },
/*::[*/0x000F/*::]*/: { n:"LABEL", f:parse_LABEL },
/*::[*/0x0010/*::]*/: { n:"FORMULA", f:parse_FORMULA },
/*::[*/0x0018/*::]*/: { n:"TABLE", f:parsenoop },
/*::[*/0x0019/*::]*/: { n:"ORANGE", f:parsenoop },
/*::[*/0x001A/*::]*/: { n:"PRANGE", f:parsenoop },
/*::[*/0x001B/*::]*/: { n:"SRANGE", f:parsenoop },
/*::[*/0x001C/*::]*/: { n:"FRANGE", f:parsenoop },
/*::[*/0x001D/*::]*/: { n:"KRANGE1", f:parsenoop },
/*::[*/0x0020/*::]*/: { n:"HRANGE", f:parsenoop },
/*::[*/0x0023/*::]*/: { n:"KRANGE2", f:parsenoop },
/*::[*/0x0024/*::]*/: { n:"PROTEC", f:parsenoop },
/*::[*/0x0025/*::]*/: { n:"FOOTER", f:parsenoop },
/*::[*/0x0026/*::]*/: { n:"HEADER", f:parsenoop },
/*::[*/0x0027/*::]*/: { n:"SETUP", f:parsenoop },
/*::[*/0x0028/*::]*/: { n:"MARGINS", f:parsenoop },
/*::[*/0x0029/*::]*/: { n:"LABELFMT", f:parsenoop },
/*::[*/0x002A/*::]*/: { n:"TITLES", f:parsenoop },
/*::[*/0x002B/*::]*/: { n:"SHEETJS", f:parsenoop },
/*::[*/0x002D/*::]*/: { n:"GRAPH", f:parsenoop },
/*::[*/0x002E/*::]*/: { n:"NGRAPH", f:parsenoop },
/*::[*/0x002F/*::]*/: { n:"CALCCOUNT", f:parsenoop },
/*::[*/0x0030/*::]*/: { n:"UNFORMATTED", f:parsenoop },
/*::[*/0x0031/*::]*/: { n:"CURSORW12", f:parsenoop },
/*::[*/0x0032/*::]*/: { n:"WINDOW", f:parsenoop },
/*::[*/0x0018/*::]*/: { n:"TABLE" },
/*::[*/0x0019/*::]*/: { n:"ORANGE" },
/*::[*/0x001A/*::]*/: { n:"PRANGE" },
/*::[*/0x001B/*::]*/: { n:"SRANGE" },
/*::[*/0x001C/*::]*/: { n:"FRANGE" },
/*::[*/0x001D/*::]*/: { n:"KRANGE1" },
/*::[*/0x0020/*::]*/: { n:"HRANGE" },
/*::[*/0x0023/*::]*/: { n:"KRANGE2" },
/*::[*/0x0024/*::]*/: { n:"PROTEC" },
/*::[*/0x0025/*::]*/: { n:"FOOTER" },
/*::[*/0x0026/*::]*/: { n:"HEADER" },
/*::[*/0x0027/*::]*/: { n:"SETUP" },
/*::[*/0x0028/*::]*/: { n:"MARGINS" },
/*::[*/0x0029/*::]*/: { n:"LABELFMT" },
/*::[*/0x002A/*::]*/: { n:"TITLES" },
/*::[*/0x002B/*::]*/: { n:"SHEETJS" },
/*::[*/0x002D/*::]*/: { n:"GRAPH" },
/*::[*/0x002E/*::]*/: { n:"NGRAPH" },
/*::[*/0x002F/*::]*/: { n:"CALCCOUNT" },
/*::[*/0x0030/*::]*/: { n:"UNFORMATTED" },
/*::[*/0x0031/*::]*/: { n:"CURSORW12" },
/*::[*/0x0032/*::]*/: { n:"WINDOW" },
/*::[*/0x0033/*::]*/: { n:"STRING", f:parse_LABEL },
/*::[*/0x0037/*::]*/: { n:"PASSWORD", f:parsenoop },
/*::[*/0x0038/*::]*/: { n:"LOCKED", f:parsenoop },
/*::[*/0x003C/*::]*/: { n:"QUERY", f:parsenoop },
/*::[*/0x003D/*::]*/: { n:"QUERYNAME", f:parsenoop },
/*::[*/0x003E/*::]*/: { n:"PRINT", f:parsenoop },
/*::[*/0x003F/*::]*/: { n:"PRINTNAME", f:parsenoop },
/*::[*/0x0040/*::]*/: { n:"GRAPH2", f:parsenoop },
/*::[*/0x0041/*::]*/: { n:"GRAPHNAME", f:parsenoop },
/*::[*/0x0042/*::]*/: { n:"ZOOM", f:parsenoop },
/*::[*/0x0043/*::]*/: { n:"SYMSPLIT", f:parsenoop },
/*::[*/0x0044/*::]*/: { n:"NSROWS", f:parsenoop },
/*::[*/0x0045/*::]*/: { n:"NSCOLS", f:parsenoop },
/*::[*/0x0046/*::]*/: { n:"RULER", f:parsenoop },
/*::[*/0x0047/*::]*/: { n:"NNAME", f:parsenoop },
/*::[*/0x0048/*::]*/: { n:"ACOMM", f:parsenoop },
/*::[*/0x0049/*::]*/: { n:"AMACRO", f:parsenoop },
/*::[*/0x004A/*::]*/: { n:"PARSE", f:parsenoop },
/*::[*/0x0037/*::]*/: { n:"PASSWORD" },
/*::[*/0x0038/*::]*/: { n:"LOCKED" },
/*::[*/0x003C/*::]*/: { n:"QUERY" },
/*::[*/0x003D/*::]*/: { n:"QUERYNAME" },
/*::[*/0x003E/*::]*/: { n:"PRINT" },
/*::[*/0x003F/*::]*/: { n:"PRINTNAME" },
/*::[*/0x0040/*::]*/: { n:"GRAPH2" },
/*::[*/0x0041/*::]*/: { n:"GRAPHNAME" },
/*::[*/0x0042/*::]*/: { n:"ZOOM" },
/*::[*/0x0043/*::]*/: { n:"SYMSPLIT" },
/*::[*/0x0044/*::]*/: { n:"NSROWS" },
/*::[*/0x0045/*::]*/: { n:"NSCOLS" },
/*::[*/0x0046/*::]*/: { n:"RULER" },
/*::[*/0x0047/*::]*/: { n:"NNAME" },
/*::[*/0x0048/*::]*/: { n:"ACOMM" },
/*::[*/0x0049/*::]*/: { n:"AMACRO" },
/*::[*/0x004A/*::]*/: { n:"PARSE" },
/*::[*/0x00FF/*::]*/: { n:"", f:parsenoop }
};
var WK3Enum = {
/*::[*/0x0000/*::]*/: { n:"BOF", f:parsenoop },
/*::[*/0x0001/*::]*/: { n:"EOF", f:parsenoop },
/*::[*/0x0003/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x0004/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x0005/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x0006/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x0007/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x0009/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x000a/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x000b/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x000c/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x000e/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x000f/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x0010/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x0011/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x0012/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x0013/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x0015/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x0000/*::]*/: { n:"BOF" },
/*::[*/0x0001/*::]*/: { n:"EOF" },
/*::[*/0x0003/*::]*/: { n:"??" },
/*::[*/0x0004/*::]*/: { n:"??" },
/*::[*/0x0005/*::]*/: { n:"??" },
/*::[*/0x0006/*::]*/: { n:"??" },
/*::[*/0x0007/*::]*/: { n:"??" },
/*::[*/0x0009/*::]*/: { n:"??" },
/*::[*/0x000a/*::]*/: { n:"??" },
/*::[*/0x000b/*::]*/: { n:"??" },
/*::[*/0x000c/*::]*/: { n:"??" },
/*::[*/0x000e/*::]*/: { n:"??" },
/*::[*/0x000f/*::]*/: { n:"??" },
/*::[*/0x0010/*::]*/: { n:"??" },
/*::[*/0x0011/*::]*/: { n:"??" },
/*::[*/0x0012/*::]*/: { n:"??" },
/*::[*/0x0013/*::]*/: { n:"??" },
/*::[*/0x0015/*::]*/: { n:"??" },
/*::[*/0x0016/*::]*/: { n:"LABEL16", f:parse_LABEL_16},
/*::[*/0x0017/*::]*/: { n:"NUMBER17", f:parse_NUMBER_17 },
/*::[*/0x0018/*::]*/: { n:"NUMBER18", f:parse_NUMBER_18 },
/*::[*/0x0019/*::]*/: { n:"FORMULA19", f:parse_FORMULA_19},
/*::[*/0x001a/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x001b/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x001c/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x001d/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x001e/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x001f/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x0021/*::]*/: { n:"??", f:parsenoop },
/*::[*/0x001a/*::]*/: { n:"??" },
/*::[*/0x001b/*::]*/: { n:"??" },
/*::[*/0x001c/*::]*/: { n:"??" },
/*::[*/0x001d/*::]*/: { n:"??" },
/*::[*/0x001e/*::]*/: { n:"??" },
/*::[*/0x001f/*::]*/: { n:"??" },
/*::[*/0x0021/*::]*/: { n:"??" },
/*::[*/0x0025/*::]*/: { n:"NUMBER25", f:parse_NUMBER_25 },
/*::[*/0x0027/*::]*/: { n:"NUMBER27", f:parse_NUMBER_27 },
/*::[*/0x0028/*::]*/: { n:"FORMULA28", f:parse_FORMULA_28 },

View File

@ -11,7 +11,7 @@ var RTF = (function() {
function rtf_to_sheet_str(str/*:string*/, opts)/*:Worksheet*/ {
var o = opts || {};
var ws/*:Worksheet*/ = ({}/*:any*/);
var ws/*:Worksheet*/ = o.dense ? ([]/*:any*/) : ({}/*:any*/);
var range/*:Range*/ = ({s: {c:0, r:0}, e: {c:0, r:0}}/*:any*/);
// TODO: parse

View File

@ -134,9 +134,10 @@ function write_BrtFill(fill, o) {
/* [MS-XLSB] 2.4.816 BrtXF */
function parse_BrtXF(data, length/*:number*/) {
var tgt = data.l + length;
var ixfeParent = data.read_shift(2);
var ifmt = data.read_shift(2);
parsenoop(data, length-4);
data.l = tgt;
return {ixfe:ixfeParent, numFmtId:ifmt };
}
function write_BrtXF(data, ixfeP, o) {

View File

@ -2,7 +2,7 @@ RELS.DS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/d
RELS.MS = "http://schemas.microsoft.com/office/2006/relationships/xlMacrosheet";
/* macro and dialog sheet stubs */
function parse_ds_bin(data/*:any*/, opts, rels, wb, themes, styles)/*:Worksheet*/ { return {'!type':'dialog'}; }
function parse_ds_xml(data/*:any*/, opts, rels, wb, themes, styles)/*:Worksheet*/ { return {'!type':'dialog'}; }
function parse_ms_bin(data/*:any*/, opts, rels, wb, themes, styles)/*:Worksheet*/ { return {'!type':'macro'}; }
function parse_ms_xml(data/*:any*/, opts, rels, wb, themes, styles)/*:Worksheet*/ { return {'!type':'macro'}; }
function parse_ds_bin(data/*:any*/, opts, idx/*:number*/, rels, wb, themes, styles)/*:Worksheet*/ { return {'!type':'dialog'}; }
function parse_ds_xml(data/*:any*/, opts, idx/*:number*/, rels, wb, themes, styles)/*:Worksheet*/ { return {'!type':'dialog'}; }
function parse_ms_bin(data/*:any*/, opts, idx/*:number*/, rels, wb, themes, styles)/*:Worksheet*/ { return {'!type':'macro'}; }
function parse_ms_xml(data/*:any*/, opts, idx/*:number*/, rels, wb, themes, styles)/*:Worksheet*/ { return {'!type':'macro'}; }

View File

@ -849,7 +849,6 @@ function stringify_formula(formula/*Array<any>*/, range, cell/*:any*/, supbooks,
break;
case 'PtgArea3d': /* 2.5.198.28 TODO */
type = f[1][0]; ixti = /*::Number(*/f[1][1]/*::)*/; r = f[1][2];
//sname = (supbooks && supbooks[1] ? supbooks[1][ixti+1] : "**MISSING**");
sname = get_ixti(supbooks, ixti, opts);
stack.push(sname + "!" + encode_range_xls((r/*:any*/), opts));
break;
@ -923,7 +922,7 @@ function stringify_formula(formula/*Array<any>*/, range, cell/*:any*/, supbooks,
stack.push('#REF!'); break;
case 'PtgExp': /* 2.5.198.58 TODO */
c = {c:f[1][1],r:f[1][0]};
c = {c:(f[1][1]/*:any*/),r:(f[1][0]/*:any*/)};
var q = ({c: cell.c, r:cell.r}/*:any*/);
if(supbooks.sharedf[encode_cell(c)]) {
var parsedf = (supbooks.sharedf[encode_cell(c)]);

View File

@ -9,8 +9,9 @@ var dimregex = /"(\w*:\w*)"/;
var colregex = /<(?:\w:)?col[^>]*[\/]?>/g;
var afregex = /<(?:\w:)?autoFilter[^>]*([\/]|>([\s\S]*)<\/(?:\w:)?autoFilter)>/g;
var marginregex= /<(?:\w:)?pageMargins[^>]*\/>/g;
var sheetprregex = /<(?:\w:)?sheetPr(?:[^>a-z][^>]*)?\/>/;
/* 18.3 Worksheets */
function parse_ws_xml(data/*:?string*/, opts, rels, wb, themes, styles)/*:Worksheet*/ {
function parse_ws_xml(data/*:?string*/, opts, idx, rels, wb/*:WBWBProps*/, themes, styles)/*:Worksheet*/ {
if(!data) return data;
if(DENSE != null && opts.dense == null) opts.dense = DENSE;
@ -25,6 +26,10 @@ function parse_ws_xml(data/*:?string*/, opts, rels, wb, themes, styles)/*:Worksh
data2 = data.substr(mtch.index + mtch[0].length);
} else data1 = data2 = data;
/* 18.3.1.82 sheetPr CT_SheetPr */
var sheetPr = data1.match(sheetprregex);
if(sheetPr) parse_ws_xml_sheetpr(sheetPr[0], s, wb, idx);
/* 18.3.1.35 dimension CT_SheetDimension ? */
// $FlowIgnore
var ridx = (data1.match(/<(?:\w*:)?dimension/)||{index:-1}).index;
@ -87,7 +92,14 @@ function write_ws_xml_merges(merges) {
return o + '</mergeCells>';
}
/* 18.3.1.85 sheetPr CT_SheetProtection */
/* 18.3.1.82-3 sheetPr CT_ChartsheetPr / CT_SheetPr */
function parse_ws_xml_sheetpr(sheetPr/*:string*/, s, wb/*:WBWBProps*/, idx/*:number*/) {
var data = parsexmltag(sheetPr);
if(!wb.Sheets[idx]) wb.Sheets[idx] = {};
if(data.codeName) wb.Sheets[idx].CodeName = data.codeName;
}
/* 18.3.1.85 sheetProtection CT_SheetProtection */
function write_ws_xml_protection(sp)/*:string*/ {
// algorithmName, hashValue, saltValue, spinCountpassword
var o = ({sheet:1}/*:any*/);
@ -326,7 +338,10 @@ return function parse_ws_xml_data(sdata, s, opts, guess, themes, styles) {
/* 18.18.11 t ST_CellType */
switch(p.t) {
case 'n':
p.v = parseFloat(p.v);
if(p.v == "" || p.v == null) {
if(!opts.sheetStubs) continue;
p.t = 'z';
} else p.v = parseFloat(p.v);
break;
case 's':
if(typeof p.v == 'undefined') {
@ -441,7 +456,9 @@ function write_ws_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ {
ws['!comments'] = [];
ws['!drawing'] = [];
o[o.length] = (writextag('sheetPr', null, {'codeName': escapexml(wb.SheetNames[idx])}));
var cname = wb.SheetNames[idx];
try { if(wb.Workbook) cname = wb.Workbook.Sheets[idx].CodeName || cname; } catch(e) {}
o[o.length] = (writextag('sheetPr', null, {'codeName': escapexml(cname)}));
o[o.length] = (writextag('dimension', null, {'ref': ref}));

View File

@ -382,7 +382,7 @@ function write_BrtSheetProtection(sp, o) {
}
/* [MS-XLSB] 2.1.7.61 Worksheet */
function parse_ws_bin(data, _opts, rels, wb, themes, styles)/*:Worksheet*/ {
function parse_ws_bin(data, _opts, idx, rels, wb, themes, styles)/*:Worksheet*/ {
if(!data) return data;
var opts = _opts || {};
if(!rels) rels = {'!id':{}};
@ -412,7 +412,6 @@ function parse_ws_bin(data, _opts, rels, wb, themes, styles)/*:Worksheet*/ {
}
var colinfo = [], rowinfo = [];
var defwidth = 0, defheight = 0; // twips / MDW respectively
var seencol = false;
recordhopper(data, function ws_parse(val, R_n, RT) {
@ -540,6 +539,11 @@ function parse_ws_bin(data, _opts, rels, wb, themes, styles)/*:Worksheet*/ {
s['!margins'] = val;
break;
case 0x0093: /* 'BrtWsProp' */
if(!wb.Sheets[idx]) wb.Sheets[idx] = {};
if(val.name) wb.Sheets[idx].CodeName = val.name;
break;
case 0x01E5: /* 'BrtWsFmtInfo' */
/* case 'BrtUid' */
case 0x00AF: /* 'BrtAFilterDateGroupItem' */
@ -594,7 +598,6 @@ function parse_ws_bin(data, _opts, rels, wb, themes, styles)/*:Worksheet*/ {
case 0x0032: /* 'BrtValueMeta' */
case 0x0816: /* 'BrtWebExtension' */
case 0x0415: /* 'BrtWsFmtInfoEx14' */
case 0x0093: /* 'BrtWsProp' */
break;
case 0x0023: /* 'BrtFRTBegin' */
@ -772,12 +775,13 @@ function write_SHEETPROTECT(ba, ws) {
function write_ws_bin(idx/*:number*/, opts, wb/*:Workbook*/, rels) {
var ba = buf_array();
var s = wb.SheetNames[idx], ws = wb.Sheets[s] || {};
var c/*:string*/ = s; try { if(wb && wb.Workbook) c = wb.Workbook.Sheets[idx].CodeName || c; } catch(e) {}
var r = safe_decode_range(ws['!ref'] || "A1");
ws['!links'] = [];
/* passed back to write_zip and removed there */
ws['!comments'] = [];
write_record(ba, "BrtBeginSheet");
write_record(ba, "BrtWsProp", write_BrtWsProp(s));
write_record(ba, "BrtWsProp", write_BrtWsProp(c));
write_record(ba, "BrtWsDim", write_BrtWsDim(r));
write_WSVIEWS2(ba, ws);
write_WSFMTINFO(ba, ws);

View File

@ -6,13 +6,17 @@ var CS_XML_ROOT = writextag('chartsheet', null, {
});
/* 18.3 Worksheets also covers Chartsheets */
function parse_cs_xml(data/*:?string*/, opts, rels, wb, themes, styles)/*:Worksheet*/ {
function parse_cs_xml(data/*:?string*/, opts, idx/*:number*/, rels, wb, themes, styles)/*:Worksheet*/ {
if(!data) return data;
/* 18.3.1.12 chartsheet CT_ChartSheet */
if(!rels) rels = {'!id':{}};
var s = {'!type':"chart", '!chart':null, '!rel':""};
var m;
/* 18.3.1.83 sheetPr CT_ChartsheetPr */
var sheetPr = data.match(sheetprregex);
if(sheetPr) parse_ws_xml_sheetpr(sheetPr[0], s, wb, idx);
/* 18.3.1.36 drawing CT_Drawing */
if((m = data.match(/drawing r:id="(.*?)"/))) s['!rel'] = m[1];
@ -27,8 +31,15 @@ function write_cs_xml(idx/*:number*/, opts, wb/*:Workbook*/, rels)/*:string*/ {
return o.join("");
}
/* [MS-XLSB] 2.4.331 BrtCsProp */
function parse_BrtCsProp(data, length/*:number*/) {
data.l += 10;
var name = parse_XLWideString(data, length - 10);
return { name: name };
}
/* [MS-XLSB] 2.1.7.7 Chart Sheet */
function parse_cs_bin(data, opts, rels, wb, themes, styles)/*:Worksheet*/ {
function parse_cs_bin(data, opts, idx/*:number*/, rels, wb, themes, styles)/*:Worksheet*/ {
if(!data) return data;
if(!rels) rels = {'!id':{}};
var s = {'!type':"chart", '!chart':null, '!rel':""};
@ -40,10 +51,14 @@ function parse_cs_bin(data, opts, rels, wb, themes, styles)/*:Worksheet*/ {
case 0x0226: /* 'BrtDrawing' */
s['!rel'] = val; break;
case 0x028B: /* 'BrtCsProp' */
if(!wb.Sheets[idx]) wb.Sheets[idx] = {};
if(val.name) wb.Sheets[idx].CodeName = val.name;
break;
/* case 'BrtUid': */
case 0x0232: /* 'BrtBkHim' */
case 0x028C: /* 'BrtCsPageSetup' */
case 0x028B: /* 'BrtCsProp' */
case 0x029D: /* 'BrtCsProtection' */
case 0x02A7: /* 'BrtCsProtectionIso' */
case 0x0227: /* 'BrtLegacyDrawing' */

View File

@ -4,7 +4,7 @@ var WBPropsDef = [
['autoCompressPictures', true, "bool"],
['backupFile', false, "bool"],
['checkCompatibility', false, "bool"],
['codeName', ''],
['CodeName', ''],
['date1904', false, "bool"],
['defaultThemeVersion', 0, "int"],
['filterPrivacy', false, "bool"],

View File

@ -36,6 +36,7 @@ function parse_wb_xml(data, opts)/*:WorkbookFile*/ {
default: wb.WBProps[w[0]] = y[w[0]];
}
});
if(y.codeName) wb.WBProps.CodeName = y.codeName;
break;
case '</workbookPr>': break;
@ -170,15 +171,16 @@ function write_wb_xml(wb/*:Workbook*/, opts/*:?WriteOpts*/)/*:string*/ {
/* fileVersion */
/* fileSharing */
var workbookPr/*:WBProps*/ = ({codeName:"ThisWorkbook"}/*:any*/);
var workbookPr/*:any*/ = ({codeName:"ThisWorkbook"}/*:any*/);
if(wb.Workbook && wb.Workbook.WBProps) {
if(wb.Workbook.WBProps.codeName) workbookPr.codeName = wb.Workbook.WBProps.codeName;
WBPropsDef.forEach(function(x) {
/*:: if(!wb.Workbook || !wb.Workbook.WBProps) throw "unreachable"; */
if((wb.Workbook.WBProps[x[0]]/*:any*/) == null) return;
if((wb.Workbook.WBProps[x[0]]/*:any*/) == x[1]) return;
workbookPr[x[0]] = (wb.Workbook.WBProps[x[0]]/*:any*/);
});
/*:: if(!wb.Workbook || !wb.Workbook.WBProps) throw "unreachable"; */
if(wb.Workbook.WBProps.CodeName) { workbookPr.codeName = wb.Workbook.WBProps.CodeName; delete workbookPr.CodeName; }
}
o[o.length] = (writextag('workbookPr', null, workbookPr));

View File

@ -22,7 +22,7 @@ function parse_BrtWbProp(data, length)/*:WBProps*/ {
var flags = data.read_shift(4);
o.defaultThemeVersion = data.read_shift(4);
var strName = (length > 8) ? parse_XLWideString(data) : "";
if(strName.length > 0) o.codeName = strName;
if(strName.length > 0) o.CodeName = strName;
o.autoCompressPictures = !!(flags & 0x10000);
o.backupFile = !!(flags & 0x40);
o.checkCompatibility = !!(flags & 0x1000);
@ -49,7 +49,7 @@ function write_BrtWbProp(data/*:?WBProps*/, o) {
}
o.write_shift(4, flags);
o.write_shift(4, 0);
write_XLSBCodeName("ThisWorkbook", o);
write_XLSBCodeName(data && data.CodeName || "ThisWorkbook", o);
return o.slice(0, o.l);
}

View File

@ -3,24 +3,24 @@ function parse_wb(data, name/*:string*/, opts)/*:WorkbookFile*/ {
return parse_wb_xml((data/*:any*/), opts);
}
function parse_ws(data, name/*:string*/, opts, rels, wb, themes, styles)/*:Worksheet*/ {
if(name.slice(-4)===".bin") return parse_ws_bin((data/*:any*/), opts, rels, wb, themes, styles);
return parse_ws_xml((data/*:any*/), opts, rels, wb, themes, styles);
function parse_ws(data, name/*:string*/, idx/*:number*/, opts, rels, wb, themes, styles)/*:Worksheet*/ {
if(name.slice(-4)===".bin") return parse_ws_bin((data/*:any*/), opts, idx, rels, wb, themes, styles);
return parse_ws_xml((data/*:any*/), opts, idx, rels, wb, themes, styles);
}
function parse_cs(data, name/*:string*/, opts, rels, wb, themes, styles)/*:Worksheet*/ {
if(name.slice(-4)===".bin") return parse_cs_bin((data/*:any*/), opts, rels, wb, themes, styles);
return parse_cs_xml((data/*:any*/), opts, rels, wb, themes, styles);
function parse_cs(data, name/*:string*/, idx/*:number*/, opts, rels, wb, themes, styles)/*:Worksheet*/ {
if(name.slice(-4)===".bin") return parse_cs_bin((data/*:any*/), opts, idx, rels, wb, themes, styles);
return parse_cs_xml((data/*:any*/), opts, idx, rels, wb, themes, styles);
}
function parse_ms(data, name/*:string*/, opts, rels, wb, themes, styles)/*:Worksheet*/ {
if(name.slice(-4)===".bin") return parse_ms_bin((data/*:any*/), opts, rels, wb, themes, styles);
return parse_ms_xml((data/*:any*/), opts, rels, wb, themes, styles);
function parse_ms(data, name/*:string*/, idx/*:number*/, opts, rels, wb, themes, styles)/*:Worksheet*/ {
if(name.slice(-4)===".bin") return parse_ms_bin((data/*:any*/), opts, idx, rels, wb, themes, styles);
return parse_ms_xml((data/*:any*/), opts, idx, rels, wb, themes, styles);
}
function parse_ds(data, name/*:string*/, opts, rels, wb, themes, styles)/*:Worksheet*/ {
if(name.slice(-4)===".bin") return parse_ds_bin((data/*:any*/), opts, rels, wb, themes, styles);
return parse_ds_xml((data/*:any*/), opts, rels, wb, themes, styles);
function parse_ds(data, name/*:string*/, idx/*:number*/, opts, rels, wb, themes, styles)/*:Worksheet*/ {
if(name.slice(-4)===".bin") return parse_ds_bin((data/*:any*/), opts, idx, rels, wb, themes, styles);
return parse_ds_xml((data/*:any*/), opts, idx, rels, wb, themes, styles);
}
function parse_sty(data, name/*:string*/, themes, opts) {

View File

@ -266,7 +266,9 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
case 'CalcRefMode': opts.CalcRefMode = val; break; // TODO: implement R1C1
case 'Uncalced': break;
case 'ForceFullCalculation': wb.opts.FullCalc = val; break;
case 'WsBool': break; // TODO
case 'WsBool':
if(val.fDialog) out["!type"] = "dialog";
break; // TODO
case 'XF': XFs.push(val); break;
case 'ExtSST': break; // TODO
case 'BookExt': break; // TODO
@ -354,6 +356,7 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
}
else cur_sheet = (Directory[s] || {name:""}).name;
if(val.dt == 0x20) out["!type"] = "chart";
if(val.dt == 0x40) out["!type"] = "macro";
mergecells = [];
objects = [];
array_formulae = []; opts.arrayf = array_formulae;
@ -661,7 +664,8 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
} break;
case 'CodeName': {
/*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */
if(!cur_sheet) Workbook.WBProps.codeName = val;
if(!cur_sheet) Workbook.WBProps.CodeName = val || "ThisWorkbook";
else wsprops.CodeName = val || wsprops.name;
} break;
case 'GUIDTypeLib': {
/* empty */

View File

@ -565,7 +565,7 @@ var XLSBRecordEnum = {
/*::[*/0x0288/*::]*/: { n:"BrtBeginCellIgnoreECs" },
/*::[*/0x0289/*::]*/: { n:"BrtCellIgnoreEC" },
/*::[*/0x028A/*::]*/: { n:"BrtEndCellIgnoreECs" },
/*::[*/0x028B/*::]*/: { n:"BrtCsProp" },
/*::[*/0x028B/*::]*/: { n:"BrtCsProp", f:parse_BrtCsProp },
/*::[*/0x028C/*::]*/: { n:"BrtCsPageSetup" },
/*::[*/0x028D/*::]*/: { n:"BrtBeginUserCsViews" },
/*::[*/0x028E/*::]*/: { n:"BrtEndUserCsViews" },
@ -881,7 +881,7 @@ var XLSRecordEnum = {
/*::[*/0x0063/*::]*/: { n:"ObjProtect", f:parsebool },
/*::[*/0x007d/*::]*/: { n:"ColInfo", f:parse_ColInfo },
/*::[*/0x0080/*::]*/: { n:"Guts", f:parse_Guts },
/*::[*/0x0081/*::]*/: { n:"WsBool" },
/*::[*/0x0081/*::]*/: { n:"WsBool", f:parse_WsBool },
/*::[*/0x0082/*::]*/: { n:"GridSet", f:parseuint16 },
/*::[*/0x0083/*::]*/: { n:"HCenter", f:parsebool },
/*::[*/0x0084/*::]*/: { n:"VCenter", f:parsebool },
@ -1026,9 +1026,9 @@ var XLSRecordEnum = {
/*::[*/0x0221/*::]*/: { n:"Array", f:parse_Array },
/*::[*/0x0225/*::]*/: { n:"DefaultRowHeight", f:parse_DefaultRowHeight },
/*::[*/0x0236/*::]*/: { n:"Table" },
/*::[*/0x023e/*::]*/: { n:"Window2", f:parsenoop },
/*::[*/0x023e/*::]*/: { n:"Window2" },
/*::[*/0x027e/*::]*/: { n:"RK", f:parse_RK },
/*::[*/0x0293/*::]*/: { n:"Style", f:parsenoop },
/*::[*/0x0293/*::]*/: { n:"Style" },
/*::[*/0x0406/*::]*/: { n:"Formula", f:parse_Formula },
/*::[*/0x0418/*::]*/: { n:"BigName" },
/*::[*/0x041e/*::]*/: { n:"Format", f:parse_Format },
@ -1101,7 +1101,7 @@ var XLSRecordEnum = {
/*::[*/0x088e/*::]*/: { n:"TableStyles", r:12 },
/*::[*/0x088f/*::]*/: { n:"TableStyle" },
/*::[*/0x0890/*::]*/: { n:"TableStyleElement" },
/*::[*/0x0892/*::]*/: { n:"StyleExt", f:parsenoop },
/*::[*/0x0892/*::]*/: { n:"StyleExt" },
/*::[*/0x0893/*::]*/: { n:"NamePublish" },
/*::[*/0x0894/*::]*/: { n:"NameCmt", f:parse_NameCmt, r:12 },
/*::[*/0x0895/*::]*/: { n:"SortData" },

View File

@ -105,6 +105,7 @@ function write_ws_biff8_cell(ba/*:BufArray*/, cell/*:Cell*/, R/*:number*/, C/*:n
function write_ws_biff8(idx/*:number*/, opts, wb/*:Workbook*/) {
var ba = buf_array();
var s = wb.SheetNames[idx], ws = wb.Sheets[s] || {};
var _sheet/*:WBWSProp*/ = ((((wb||{}).Workbook||{}).Sheets||[])[idx]||{}/*:any*/);
var dense = Array.isArray(ws);
var ref/*:string*/, rr = "", cols/*:Array<string>*/ = [];
var range = safe_decode_range(ws['!ref'] || "A1");
@ -138,7 +139,7 @@ function write_ws_biff8(idx/*:number*/, opts, wb/*:Workbook*/) {
write_ws_biff8_cell(ba, cell, R, C, opts);
}
}
var cname = ((((wb||{}).Workbook||{}).Sheets||[])[idx]||{}).name||s;
var cname/*:string*/ = _sheet.CodeName || _sheet.name || s;
write_biff_rec(ba, "CodeName", write_XLUnicodeString(cname, opts));
/* ... */
write_biff_rec(ba, "EOF");
@ -148,6 +149,7 @@ function write_ws_biff8(idx/*:number*/, opts, wb/*:Workbook*/) {
/* [MS-XLS] 2.1.7.20.3 */
function write_biff8_global(wb/*:Workbook*/, bufs, opts/*:WriteOpts*/) {
var A = buf_array();
var _wb/*:WBWBProps*/ = /*::((*/(wb.Workbook||{}).WBProps||{/*::CodeName:"ThisWorkbook"*/}/*:: ):any)*/;
var b8 = opts.biff == 8, b5 = opts.biff == 5;
write_biff_rec(A, 0x0809, write_BOF(wb, 0x05, opts));
write_biff_rec(A, "InterfaceHdr", b8 ? writeuint16(0x04b0) : null);
@ -161,7 +163,8 @@ function write_biff8_global(wb/*:Workbook*/, bufs, opts/*:WriteOpts*/) {
write_biff_rec(A, "RRTabId", write_RRTabId(wb.SheetNames.length));
if(b8 && wb.vbaraw) {
write_biff_rec(A, "ObProj");
var cname = ((wb.Workbook||{}).WBProps||{}).codeName || "ThisWorkbook";
// $FlowIgnore
var cname/*:string*/ = _wb.CodeName || "ThisWorkbook";
write_biff_rec(A, "CodeName", write_XLUnicodeString(cname, opts));
}
write_biff_rec(A, "BuiltInFnGroupCount", writeuint16(0x11));

View File

@ -84,7 +84,7 @@ var HTML_ = (function() {
var sp = {};
if(RS > 1) sp.rowspan = RS;
if(CS > 1) sp.colspan = CS;
if(o.editable) w = '<span contenteditable="true">' + w + '</span>'
if(o.editable) w = '<span contenteditable="true">' + w + '</span>';
sp.id = "sjs-" + coord;
oo.push(writextag('td', w, sp));
}

View File

@ -13,25 +13,25 @@ function safe_parse_wbrels(wbrels, sheets) {
return !wbrels || wbrels.length === 0 ? null : wbrels;
}
function safe_parse_sheet(zip, path/*:string*/, relsPath/*:string*/, sheet, sheetRels, sheets, stype/*:string*/, opts, wb, themes, styles) {
function safe_parse_sheet(zip, path/*:string*/, relsPath/*:string*/, sheet, idx/*:number*/, sheetRels, sheets, stype/*:string*/, opts, wb, themes, styles) {
try {
sheetRels[sheet]=parse_rels(getzipstr(zip, relsPath, true), path);
var data = getzipdata(zip, path);
switch(stype) {
case 'sheet': sheets[sheet]=parse_ws(data, path, opts,sheetRels[sheet], wb, themes, styles); break;
case 'sheet': sheets[sheet]=parse_ws(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); break;
case 'chart':
var cs = parse_cs(data, path, opts,sheetRels[sheet], wb, themes, styles);
var cs = parse_cs(data, path, idx, opts, sheetRels[sheet], wb, themes, styles);
sheets[sheet] = cs;
if(!cs || !cs['!chart']) break;
var dfile = resolve_path(cs['!chart'].Target, path);
var drelsp = get_rels_path(dfile);
var draw = parse_drawing(getzipstr(zip, dfile, true), parse_rels(getzipstr(zip,drelsp,true), dfile));
var draw = parse_drawing(getzipstr(zip, dfile, true), parse_rels(getzipstr(zip, drelsp, true), dfile));
var chartp = resolve_path(draw, dfile);
var crelsp = get_rels_path(chartp);
cs = parse_chart(getzipstr(zip, chartp, true), chartp, opts, parse_rels(getzipstr(zip, crelsp,true), chartp), wb, cs);
cs = parse_chart(getzipstr(zip, chartp, true), chartp, opts, parse_rels(getzipstr(zip, crelsp, true), chartp), wb, cs);
break;
case 'macro': sheets[sheet]=parse_ms(data, path, opts,sheetRels[sheet], wb, themes, styles); break;
case 'dialog': sheets[sheet]=parse_ds(data, path, opts,sheetRels[sheet], wb, themes, styles); break;
case 'macro': sheets[sheet]=parse_ms(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); break;
case 'dialog': sheets[sheet]=parse_ds(data, path, idx, opts, sheetRels[sheet], wb, themes, styles); break;
}
} catch(e) { if(opts.WTF) throw e; }
}
@ -147,7 +147,7 @@ function parse_zip(zip/*:ZIP*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
path = path.replace(/sheet0\./,"sheet.");
}
relsPath = path.replace(/^(.*)(\/)([^\/]*)$/, "$1/_rels/$3.rels");
safe_parse_sheet(zip, path, relsPath, props.SheetNames[i], sheetRels, sheets, stype, opts, wb, themes, styles);
safe_parse_sheet(zip, path, relsPath, props.SheetNames[i], i, sheetRels, sheets, stype, opts, wb, themes, styles);
}
if(dir.comments) parse_comments(zip, dir.comments, sheets, sheetRels, opts);

View File

@ -67,6 +67,7 @@ function write_binary_type(out, opts/*:WriteOpts*/)/*:any*/ {
case "base64":
case "binary":
var bstr = "";
// $FlowIgnore
for(var i = 0; i < out.length; ++i) bstr += String.fromCharCode(out[i]);
return opts.type == 'base64' ? Base64.encode(bstr) : opts.type == 'string' ? utf8read(bstr) : bstr;
case "file": return _fs.writeFileSync(opts.file, out);

View File

@ -12,3 +12,4 @@ XLSX.writeFileSync = writeFileSync;
XLSX.writeFileAsync = writeFileAsync;
XLSX.utils = utils;
XLSX.SSF = SSF;
XLSX.CFB = CFB;

28
dist/xlsx.core.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

26
dist/xlsx.full.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

337
dist/xlsx.js vendored
View File

@ -4,7 +4,7 @@
/*global global, exports, module, require:false, process:false, Buffer:false */
var XLSX = {};
(function make_xlsx(XLSX){
XLSX.version = '0.11.9';
XLSX.version = '0.11.10';
var current_codepage = 1200;
/*global cptable:true */
if(typeof module !== "undefined" && typeof require !== 'undefined') {
@ -53,14 +53,14 @@ var Base64 = (function make_b64(){
return {
encode: function(input) {
var o = "";
var c1, c2, c3, e1, e2, e3, e4;
var c1=0, c2=0, c3=0, e1=0, e2=0, e3=0, e4=0;
for(var i = 0; i < input.length; ) {
c1 = input.charCodeAt(i++);
c2 = input.charCodeAt(i++);
c3 = input.charCodeAt(i++);
e1 = c1 >> 2;
e2 = (c1 & 3) << 4 | c2 >> 4;
e3 = (c2 & 15) << 2 | c3 >> 6;
e2 = ((c1 & 3) << 4) | (c2 >> 4);
e3 = ((c2 & 15) << 2) | (c3 >> 6);
e4 = c3 & 63;
if (isNaN(c2)) { e3 = e4 = 64; }
else if (isNaN(c3)) { e4 = 64; }
@ -70,20 +70,20 @@ var Base64 = (function make_b64(){
},
decode: function b64_decode(input) {
var o = "";
var c1, c2, c3;
var e1, e2, e3, e4;
var c1=0, c2=0, c3=0;
var e1=0, e2=0, e3=0, e4=0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
for(var i = 0; i < input.length;) {
e1 = map.indexOf(input.charAt(i++));
e2 = map.indexOf(input.charAt(i++));
e3 = map.indexOf(input.charAt(i++));
e4 = map.indexOf(input.charAt(i++));
c1 = e1 << 2 | e2 >> 4;
c2 = (e2 & 15) << 4 | e3 >> 2;
c3 = (e3 & 3) << 6 | e4;
c1 = (e1 << 2) | (e2 >> 4);
c2 = ((e2 & 15) << 4) | (e3 >> 2);
c3 = ((e3 & 3) << 6) | e4;
o += String.fromCharCode(c1);
if (e3 != 64) { o += String.fromCharCode(c2); }
if (e4 != 64) { o += String.fromCharCode(c3); }
if (e3 !== 64) { o += String.fromCharCode(c2); }
if (e4 !== 64) { o += String.fromCharCode(c3); }
}
return o;
}
@ -4659,6 +4659,12 @@ function write_WriteAccess(s, opts) {
return o;
}
/* 2.4.351 */
function parse_WsBool(blob, length, opts) {
var flags = opts && opts.biff == 8 || length == 2 ? blob.read_shift(2) : (blob.l += length, 0);
return { fDialog: flags & 0x10 };
}
/* 2.4.28 */
function parse_BoundSheet8(blob, length, opts) {
var pos = blob.read_shift(4);
@ -6192,7 +6198,7 @@ var WK_ = (function() {
var R = Enum[RT] || Enum[0xFF];
var length = data.read_shift(2);
var tgt = data.l + length;
var d = R.f(data, length, opts);
var d = (R.f||parsenoop)(data, length, opts);
data.l = tgt;
if(cb(d, R.n, RT)) return;
}
@ -6263,7 +6269,10 @@ var WK_ = (function() {
sidx = val[3]; n = "Sheet" + (sidx + 1);
snames.push(n);
}
s[encode_cell(val[0])] = val[1];
if(o.dense) {
if(!s[val[0].r]) s[val[0].r] = [];
s[val[0].r][val[0].c] = val[1];
} else s[encode_cell(val[0])] = val[1];
if(refguess.e.c < val[0].c) refguess.e.c = val[0].c;
if(refguess.e.r < val[0].r) refguess.e.r = val[0].r;
break;
@ -6411,95 +6420,95 @@ var WK_ = (function() {
var WK1Enum = {
0x0000: { n:"BOF", f:parseuint16 },
0x0001: { n:"EOF", f:parsenoop },
0x0002: { n:"CALCMODE", f:parsenoop },
0x0003: { n:"CALCORDER", f:parsenoop },
0x0004: { n:"SPLIT", f:parsenoop },
0x0005: { n:"SYNC", f:parsenoop },
0x0001: { n:"EOF" },
0x0002: { n:"CALCMODE" },
0x0003: { n:"CALCORDER" },
0x0004: { n:"SPLIT" },
0x0005: { n:"SYNC" },
0x0006: { n:"RANGE", f:parse_RANGE },
0x0007: { n:"WINDOW1", f:parsenoop },
0x0008: { n:"COLW1", f:parsenoop },
0x0009: { n:"WINTWO", f:parsenoop },
0x000A: { n:"COLW2", f:parsenoop },
0x000B: { n:"NAME", f:parsenoop },
0x000C: { n:"BLANK", f:parsenoop },
0x0007: { n:"WINDOW1" },
0x0008: { n:"COLW1" },
0x0009: { n:"WINTWO" },
0x000A: { n:"COLW2" },
0x000B: { n:"NAME" },
0x000C: { n:"BLANK" },
0x000D: { n:"INTEGER", f:parse_INTEGER },
0x000E: { n:"NUMBER", f:parse_NUMBER },
0x000F: { n:"LABEL", f:parse_LABEL },
0x0010: { n:"FORMULA", f:parse_FORMULA },
0x0018: { n:"TABLE", f:parsenoop },
0x0019: { n:"ORANGE", f:parsenoop },
0x001A: { n:"PRANGE", f:parsenoop },
0x001B: { n:"SRANGE", f:parsenoop },
0x001C: { n:"FRANGE", f:parsenoop },
0x001D: { n:"KRANGE1", f:parsenoop },
0x0020: { n:"HRANGE", f:parsenoop },
0x0023: { n:"KRANGE2", f:parsenoop },
0x0024: { n:"PROTEC", f:parsenoop },
0x0025: { n:"FOOTER", f:parsenoop },
0x0026: { n:"HEADER", f:parsenoop },
0x0027: { n:"SETUP", f:parsenoop },
0x0028: { n:"MARGINS", f:parsenoop },
0x0029: { n:"LABELFMT", f:parsenoop },
0x002A: { n:"TITLES", f:parsenoop },
0x002B: { n:"SHEETJS", f:parsenoop },
0x002D: { n:"GRAPH", f:parsenoop },
0x002E: { n:"NGRAPH", f:parsenoop },
0x002F: { n:"CALCCOUNT", f:parsenoop },
0x0030: { n:"UNFORMATTED", f:parsenoop },
0x0031: { n:"CURSORW12", f:parsenoop },
0x0032: { n:"WINDOW", f:parsenoop },
0x0018: { n:"TABLE" },
0x0019: { n:"ORANGE" },
0x001A: { n:"PRANGE" },
0x001B: { n:"SRANGE" },
0x001C: { n:"FRANGE" },
0x001D: { n:"KRANGE1" },
0x0020: { n:"HRANGE" },
0x0023: { n:"KRANGE2" },
0x0024: { n:"PROTEC" },
0x0025: { n:"FOOTER" },
0x0026: { n:"HEADER" },
0x0027: { n:"SETUP" },
0x0028: { n:"MARGINS" },
0x0029: { n:"LABELFMT" },
0x002A: { n:"TITLES" },
0x002B: { n:"SHEETJS" },
0x002D: { n:"GRAPH" },
0x002E: { n:"NGRAPH" },
0x002F: { n:"CALCCOUNT" },
0x0030: { n:"UNFORMATTED" },
0x0031: { n:"CURSORW12" },
0x0032: { n:"WINDOW" },
0x0033: { n:"STRING", f:parse_LABEL },
0x0037: { n:"PASSWORD", f:parsenoop },
0x0038: { n:"LOCKED", f:parsenoop },
0x003C: { n:"QUERY", f:parsenoop },
0x003D: { n:"QUERYNAME", f:parsenoop },
0x003E: { n:"PRINT", f:parsenoop },
0x003F: { n:"PRINTNAME", f:parsenoop },
0x0040: { n:"GRAPH2", f:parsenoop },
0x0041: { n:"GRAPHNAME", f:parsenoop },
0x0042: { n:"ZOOM", f:parsenoop },
0x0043: { n:"SYMSPLIT", f:parsenoop },
0x0044: { n:"NSROWS", f:parsenoop },
0x0045: { n:"NSCOLS", f:parsenoop },
0x0046: { n:"RULER", f:parsenoop },
0x0047: { n:"NNAME", f:parsenoop },
0x0048: { n:"ACOMM", f:parsenoop },
0x0049: { n:"AMACRO", f:parsenoop },
0x004A: { n:"PARSE", f:parsenoop },
0x0037: { n:"PASSWORD" },
0x0038: { n:"LOCKED" },
0x003C: { n:"QUERY" },
0x003D: { n:"QUERYNAME" },
0x003E: { n:"PRINT" },
0x003F: { n:"PRINTNAME" },
0x0040: { n:"GRAPH2" },
0x0041: { n:"GRAPHNAME" },
0x0042: { n:"ZOOM" },
0x0043: { n:"SYMSPLIT" },
0x0044: { n:"NSROWS" },
0x0045: { n:"NSCOLS" },
0x0046: { n:"RULER" },
0x0047: { n:"NNAME" },
0x0048: { n:"ACOMM" },
0x0049: { n:"AMACRO" },
0x004A: { n:"PARSE" },
0x00FF: { n:"", f:parsenoop }
};
var WK3Enum = {
0x0000: { n:"BOF", f:parsenoop },
0x0001: { n:"EOF", f:parsenoop },
0x0003: { n:"??", f:parsenoop },
0x0004: { n:"??", f:parsenoop },
0x0005: { n:"??", f:parsenoop },
0x0006: { n:"??", f:parsenoop },
0x0007: { n:"??", f:parsenoop },
0x0009: { n:"??", f:parsenoop },
0x000a: { n:"??", f:parsenoop },
0x000b: { n:"??", f:parsenoop },
0x000c: { n:"??", f:parsenoop },
0x000e: { n:"??", f:parsenoop },
0x000f: { n:"??", f:parsenoop },
0x0010: { n:"??", f:parsenoop },
0x0011: { n:"??", f:parsenoop },
0x0012: { n:"??", f:parsenoop },
0x0013: { n:"??", f:parsenoop },
0x0015: { n:"??", f:parsenoop },
0x0000: { n:"BOF" },
0x0001: { n:"EOF" },
0x0003: { n:"??" },
0x0004: { n:"??" },
0x0005: { n:"??" },
0x0006: { n:"??" },
0x0007: { n:"??" },
0x0009: { n:"??" },
0x000a: { n:"??" },