version bump 0.11.18: infrastructure
- updated dependencies - fixed eslint config - fusebox demo
This commit is contained in:
parent
376db8fe9f
commit
c2ec7555fb
21
.eslintrc
21
.eslintrc
@ -2,20 +2,23 @@
|
||||
"env": { "shared-node-browser":true },
|
||||
"globals": {},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 3,
|
||||
"ecmaVersion": 3
|
||||
},
|
||||
"plugins": [ "html", "json" ],
|
||||
"!extends": "eslint:recommended",
|
||||
"extends": "eslint:recommended",
|
||||
"rules": {
|
||||
"comma-style": [ 2, "last" ],
|
||||
"comma-dangle": [ 2, "never" ],
|
||||
"curly": 0,
|
||||
"no-bitwise": 0,
|
||||
"no-console": 0,
|
||||
"no-control-regex": 0,
|
||||
"no-empty": 0,
|
||||
"no-trailing-spaces": 2,
|
||||
"no-use-before-define": [ 1, {
|
||||
"functions":false, "classes":true, "variables":false
|
||||
}],
|
||||
"no-console": 0,
|
||||
"no-bitwise": 0,
|
||||
"curly": 0,
|
||||
"comma-style": [ 2, "last" ],
|
||||
"no-trailing-spaces": 2,
|
||||
"semi": [ 2, "always" ],
|
||||
"comma-dangle": [ 2, "never" ]
|
||||
"no-useless-escape": 0,
|
||||
"semi": [ 2, "always" ]
|
||||
}
|
||||
}
|
||||
|
@ -70,6 +70,7 @@ deduplication
|
||||
destructuring
|
||||
embeddable
|
||||
filesystem
|
||||
globals
|
||||
javascript
|
||||
metadata
|
||||
natively
|
||||
|
@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/* eslint-env node */
|
||||
var n = "xlsx";
|
||||
/* vim: set ts=2 ft=javascript: */
|
||||
var n = "xlsx";
|
||||
var X = require('../');
|
||||
require('exit-on-epipe');
|
||||
var fs = require('fs'), program = require('commander');
|
||||
@ -26,7 +26,7 @@ program
|
||||
//.option('-4, --biff4','emit XLS to <sheetname> or <file>.xls (BIFF4)')
|
||||
//.option('-3, --biff3','emit XLS to <sheetname> or <file>.xls (BIFF3)')
|
||||
.option('-2, --biff2','emit XLS to <sheetname> or <file>.xls (BIFF2)')
|
||||
.option('-i, --xla', 'emit XLA to <sheetname> or <file>.xla')
|
||||
.option('-i, --xla', 'emit XLA to <sheetname> or <file>.xla')
|
||||
.option('-6, --xlml', 'emit SSML to <sheetname> or <file>.xls (2003 XML)')
|
||||
.option('-T, --fods', 'emit FODS to <sheetname> or <file>.fods (Flat ODS)')
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
/*exported XLSX */
|
||||
/*global global, exports, module, require:false, process:false, Buffer:false */
|
||||
/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false */
|
||||
var XLSX = {};
|
||||
(function make_xlsx(XLSX){
|
||||
|
@ -1 +1 @@
|
||||
XLSX.version = '0.11.17';
|
||||
XLSX.version = '0.11.18';
|
||||
|
@ -38,7 +38,7 @@ type CFBFiles = {[n:string]:CFBEntry};
|
||||
/* [MS-CFB] v20130118 */
|
||||
var CFB = (function _CFB(){
|
||||
var exports/*:CFBModule*/ = /*::(*/{}/*:: :any)*/;
|
||||
exports.version = '1.0.1';
|
||||
exports.version = '1.0.2';
|
||||
/* [MS-CFB] 2.6.4 */
|
||||
function namecmp(l/*:string*/, r/*:string*/)/*:number*/ {
|
||||
var L = l.split("/"), R = r.split("/");
|
||||
@ -474,6 +474,7 @@ function rebuild_cfb(cfb/*:CFBContainer*/, f/*:?boolean*/)/*:void*/ {
|
||||
}
|
||||
|
||||
function _write(cfb/*:CFBContainer*/, options/*:CFBWriteOpts*/)/*:RawBytes*/ {
|
||||
var _opts = options || {};
|
||||
rebuild_cfb(cfb);
|
||||
var L = (function(cfb/*:CFBContainer*/)/*:Array<number>*/{
|
||||
var mini_size = 0, fat_size = 0;
|
||||
@ -482,9 +483,10 @@ function _write(cfb/*:CFBContainer*/, options/*:CFBWriteOpts*/)/*:RawBytes*/ {
|
||||
if(!file.content) continue;
|
||||
/*:: if(file.content == null) throw new Error("unreachable"); */
|
||||
var flen = file.content.length;
|
||||
if(flen === 0){}
|
||||
else if(flen < 0x1000) mini_size += (flen + 0x3F) >> 6;
|
||||
else fat_size += (flen + 0x01FF) >> 9;
|
||||
if(flen > 0){
|
||||
if(flen < 0x1000) mini_size += (flen + 0x3F) >> 6;
|
||||
else fat_size += (flen + 0x01FF) >> 9;
|
||||
}
|
||||
}
|
||||
var dir_cnt = (cfb.FullPaths.length +3) >> 2;
|
||||
var mini_cnt = (mini_size + 7) >> 3;
|
||||
@ -569,8 +571,9 @@ function _write(cfb/*:CFBContainer*/, options/*:CFBWriteOpts*/)/*:RawBytes*/ {
|
||||
}
|
||||
file = cfb.FileIndex[i];
|
||||
if(i === 0) file.start = file.size ? file.start - 1 : ENDOFCHAIN;
|
||||
flen = 2*(file.name.length+1);
|
||||
o.write_shift(64, file.name, "utf16le");
|
||||
var _nm/*:string*/ = (i === 0 && _opts.root) || file.name;
|
||||
flen = 2*(_nm.length+1);
|
||||
o.write_shift(64, _nm, "utf16le");
|
||||
o.write_shift(2, flen);
|
||||
o.write_shift(1, file.type);
|
||||
o.write_shift(1, file.color);
|
||||
|
@ -55,7 +55,7 @@ var unescapexml/*:StringConv*/ = (function() {
|
||||
})();
|
||||
|
||||
var decregex=/[&<>'"]/g, charegex = /[\u0000-\u0008\u000b-\u001f]/g;
|
||||
function escapexml(text/*:string*/, xml/*:?boolean*/)/*:string*/{
|
||||
function escapexml(text/*:string*/)/*:string*/{
|
||||
var s = text + '';
|
||||
return s.replace(decregex, function(y) { return rencoding[y]; }).replace(charegex,function(s) { return "_x" + ("000"+s.charCodeAt(0).toString(16)).slice(-4) + "_";});
|
||||
}
|
||||
@ -82,7 +82,7 @@ var xlml_unfixstr/*:StringConv*/ = (function() {
|
||||
return function xlml_unfixstr(str/*:string*/)/*:string*/ { return str.replace(/(\r\n|[\r\n])/g,"\ "); };
|
||||
})();
|
||||
|
||||
function parsexmlbool(value/*:any*/, tag/*:?string*/)/*:boolean*/ {
|
||||
function parsexmlbool(value/*:any*/)/*:boolean*/ {
|
||||
switch(value) {
|
||||
case 1: case true: case '1': case 'true': case 'TRUE': return true;
|
||||
/* case '0': case 'false': case 'FALSE':*/
|
||||
|
@ -32,7 +32,6 @@ var ___utf16le = __utf16le;
|
||||
var __hexlify = function(b/*:RawBytes|CFBlob*/,s/*:number*/,l/*:number*/)/*:string*/ { var ss/*:Array<string>*/=[]; for(var i=s; i<s+l; ++i) ss.push(("0" + b[i].toString(16)).slice(-2)); return ss.join(""); };
|
||||
var ___hexlify = __hexlify;
|
||||
var __utf8 = function(b/*:RawBytes|CFBlob*/,s/*:number*/,e/*:number*/) { var ss=[]; for(var i=s; i<e; i++) ss.push(String.fromCharCode(__readUInt8(b,i))); return ss.join(""); };
|
||||
var ___utf8 = __utf8;
|
||||
var __lpstr = function(b/*:RawBytes|CFBlob*/,i/*:number*/) { var len = __readUInt32LE(b,i); return len > 0 ? __utf8(b, i+4,i+4+len-1) : "";};
|
||||
var ___lpstr = __lpstr;
|
||||
var __cpstr = function(b/*:RawBytes|CFBlob*/,i/*:number*/) { var len = __readUInt32LE(b,i); return len > 0 ? __utf8(b, i+4,i+4+len-1) : "";};
|
||||
@ -80,9 +79,6 @@ var __readUInt32LE = function(b/*:RawBytes|CFBlob*/, idx/*:number*/)/*:number*/
|
||||
var __readInt32LE = function(b/*:RawBytes|CFBlob*/, idx/*:number*/)/*:number*/ { return (b[idx+3]<<24)|(b[idx+2]<<16)|(b[idx+1]<<8)|b[idx]; };
|
||||
var __readInt32BE = function(b/*:RawBytes|CFBlob*/, idx/*:number*/)/*:number*/ { return (b[idx]<<24)|(b[idx+1]<<16)|(b[idx+2]<<8)|b[idx+3]; };
|
||||
|
||||
var ___unhexlify = function(s/*:string*/)/*:Array<number>*/ { return (s.match(/../g)||[]).map(function(x) { return parseInt(x,16);}); };
|
||||
var __unhexlify = typeof Buffer !== "undefined" ? function(s/*:string*/)/*:Array<number>|Buffer*/ { return Buffer.isBuffer(s) ? new Buffer(s, 'hex') : ___unhexlify(s); } : ___unhexlify;
|
||||
|
||||
function ReadShift(size/*:number*/, t/*:?string*/)/*:number|string*/ {
|
||||
var o="", oI/*:: :number = 0*/, oR, oo=[], w, vv, i, loc;
|
||||
switch(t) {
|
||||
|
@ -11,8 +11,6 @@ function unfix_col(cstr/*:string*/)/*:string*/ { return cstr.replace(/^\$([A-Z])
|
||||
function split_cell(cstr/*:string*/)/*:Array<string>*/ { return cstr.replace(/(\$?[A-Z]*)(\$?\d*)/,"$1,$2").split(","); }
|
||||
function decode_cell(cstr/*:string*/)/*:CellAddress*/ { var splt = split_cell(cstr); return { c:decode_col(splt[0]), r:decode_row(splt[1]) }; }
|
||||
function encode_cell(cell/*:CellAddress*/)/*:string*/ { return encode_col(cell.c) + encode_row(cell.r); }
|
||||
function fix_cell(cstr/*:string*/)/*:string*/ { return fix_col(fix_row(cstr)); }
|
||||
function unfix_cell(cstr/*:string*/)/*:string*/ { return unfix_col(unfix_row(cstr)); }
|
||||
function decode_range(range/*:string*/)/*:Range*/ { var x =range.split(":").map(decode_cell); return {s:x[0],e:x[x.length-1]}; }
|
||||
/*# if only one arg, it is assumed to be a Range. If 2 args, both are cell addresses */
|
||||
function encode_range(cs/*:CellAddrSpec|Range*/,ce/*:?CellAddrSpec*/)/*:string*/ {
|
||||
|
@ -17,7 +17,7 @@ function write_XLWideString(data/*:string*/, o) {
|
||||
}
|
||||
|
||||
/* [MS-XLSB] 2.5.143 */
|
||||
function parse_StrRun(data, length/*:?number*/) {
|
||||
function parse_StrRun(data) {
|
||||
return { ich: data.read_shift(2), ifnt: data.read_shift(2) };
|
||||
}
|
||||
function write_StrRun(run, o) {
|
||||
@ -71,7 +71,7 @@ function parse_XLSBCell(data)/*:any*/ {
|
||||
var col = data.read_shift(4);
|
||||
var iStyleRef = data.read_shift(2);
|
||||
iStyleRef += data.read_shift(1) <<16;
|
||||
var fPhShow = data.read_shift(1);
|
||||
data.l++; //var fPhShow = data.read_shift(1);
|
||||
return { c:col, iStyleRef: iStyleRef };
|
||||
}
|
||||
function write_XLSBCell(cell/*:any*/, o/*:?Block*/) {
|
||||
@ -101,7 +101,7 @@ function write_XLNullableWideString(data/*:string*/, o) {
|
||||
|
||||
/* [MS-XLSB] 2.5.165 */
|
||||
var parse_XLNameWideString = parse_XLWideString;
|
||||
var write_XLNameWideString = write_XLWideString;
|
||||
//var write_XLNameWideString = write_XLWideString;
|
||||
|
||||
/* [MS-XLSB] 2.5.114 */
|
||||
var parse_RelID = parse_XLNullableWideString;
|
||||
@ -154,7 +154,7 @@ var write_UncheckedRfX = write_RfX;
|
||||
/* [MS-XLSB] 2.5.171 */
|
||||
/* [MS-XLS] 2.5.342 */
|
||||
/* TODO: error checking, NaN and Infinity values are not valid Xnum */
|
||||
function parse_Xnum(data, length/*:?number*/) { return data.read_shift(8, 'f'); }
|
||||
function parse_Xnum(data/*::, length*/) { return data.read_shift(8, 'f'); }
|
||||
function write_Xnum(data, o) { return (o || new_buf(8)).write_shift(8, data, 'f'); }
|
||||
|
||||
/* [MS-XLSB] 2.5.198.2 */
|
||||
@ -172,11 +172,11 @@ var BErr = {
|
||||
var RBErr = evert_num(BErr);
|
||||
|
||||
/* [MS-XLSB] 2.4.321 BrtColor */
|
||||
function parse_BrtColor(data, length/*:number*/) {
|
||||
function parse_BrtColor(data/*::, length*/) {
|
||||
var out = {};
|
||||
var d = data.read_shift(1);
|
||||
|
||||
var fValidRGB = d & 1;
|
||||
//var fValidRGB = d & 1;
|
||||
var xColorType = d >>> 1;
|
||||
|
||||
var index = data.read_shift(1);
|
||||
@ -184,7 +184,7 @@ function parse_BrtColor(data, length/*:number*/) {
|
||||
var bR = data.read_shift(1);
|
||||
var bG = data.read_shift(1);
|
||||
var bB = data.read_shift(1);
|
||||
var bAlpha = data.read_shift(1);
|
||||
data.l++; //var bAlpha = data.read_shift(1);
|
||||
|
||||
switch(xColorType) {
|
||||
case 0: out.auto = 1; break;
|
||||
@ -236,7 +236,7 @@ function write_BrtColor(color, o) {
|
||||
}
|
||||
|
||||
/* [MS-XLSB] 2.5.52 */
|
||||
function parse_FontFlags(data, length/*:number*/, opts) {
|
||||
function parse_FontFlags(data/*::, length, opts*/) {
|
||||
var d = data.read_shift(1);
|
||||
data.l++;
|
||||
var out = {
|
||||
|
@ -17,7 +17,7 @@ var VT_VARIANT = 0x000C;
|
||||
//var VT_UI2 = 0x0012;
|
||||
var VT_UI4 = 0x0013;
|
||||
//var VT_I8 = 0x0014;
|
||||
var VT_UI8 = 0x0015;
|
||||
//var VT_UI8 = 0x0015;
|
||||
//var VT_INT = 0x0016;
|
||||
//var VT_UINT = 0x0017;
|
||||
var VT_LPSTR = 0x001E;
|
||||
|
@ -198,7 +198,7 @@ function new_ct()/*:any*/ {
|
||||
TODO:[], xmlns: "" }/*:any*/);
|
||||
}
|
||||
|
||||
function parse_ct(data/*:?string*/, opts) {
|
||||
function parse_ct(data/*:?string*/) {
|
||||
var ct = new_ct();
|
||||
if(!data || !data.match) return ct;
|
||||
var ctext = {};
|
||||
|
@ -20,7 +20,7 @@ function parse_manifest(d, opts) {
|
||||
}
|
||||
}
|
||||
|
||||
function write_manifest(manifest/*:Array<Array<string> >*/, opts)/*:string*/ {
|
||||
function write_manifest(manifest/*:Array<Array<string> >*/)/*:string*/ {
|
||||
var o = [XML_HEADER];
|
||||
o.push('<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2">\n');
|
||||
o.push(' <manifest:file-entry manifest:full-path="/" manifest:version="1.2" manifest:media-type="application/vnd.oasis.opendocument.spreadsheet"/>\n');
|
||||
@ -44,7 +44,7 @@ function write_rdf_has(base/*:string*/, file/*:string*/) {
|
||||
' </rdf:Description>\n'
|
||||
].join("");
|
||||
}
|
||||
function write_rdf(rdf, opts) {
|
||||
function write_rdf(rdf) {
|
||||
var o = [XML_HEADER];
|
||||
o.push('<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">\n');
|
||||
for(var i = 0; i != rdf.length; ++i) {
|
||||
@ -58,7 +58,7 @@ function write_rdf(rdf, opts) {
|
||||
/* TODO: pull properties */
|
||||
var write_meta_ods/*:{(wb:Workbook, opts:any):string}*/ = (function() {
|
||||
var payload = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xlink="http://www.w3.org/1999/xlink" office:version="1.2"><office:meta><meta:generator>Sheet' + 'JS ' + XLSX.version + '</meta:generator></office:meta></office:document-meta>';
|
||||
return function wmo(wb/*:Workbook*/, opts) {
|
||||
return function wmo(/*:: wb: Workbook, opts: any*/)/*:string*/ {
|
||||
return payload;
|
||||
};
|
||||
})();
|
||||
|
@ -83,8 +83,8 @@ var EXT_PROPS_XML_ROOT = writextag('Properties', null, {
|
||||
'xmlns:vt': XMLNS.vt
|
||||
});
|
||||
|
||||
function write_ext_props(cp, opts)/*:string*/ {
|
||||
var o/*:Array<string>*/ = [], p = {}, W = writextag;
|
||||
function write_ext_props(cp/*::, opts*/)/*:string*/ {
|
||||
var o/*:Array<string>*/ = [], W = writextag;
|
||||
if(!cp) cp = {};
|
||||
cp.Application = "SheetJS";
|
||||
o[o.length] = (XML_HEADER);
|
||||
|
@ -22,7 +22,7 @@ function parse_cust_props(data/*:string*/, opts) {
|
||||
p[name] = unescapexml(text);
|
||||
break;
|
||||
case 'bool':
|
||||
p[name] = parsexmlbool(text, '<vt:bool>');
|
||||
p[name] = parsexmlbool(text);
|
||||
break;
|
||||
case 'i1': case 'i2': case 'i4': case 'i8': case 'int': case 'uint':
|
||||
p[name] = parseInt(text, 10);
|
||||
@ -52,7 +52,7 @@ var CUST_PROPS_XML_ROOT = writextag('Properties', null, {
|
||||
'xmlns:vt': XMLNS.vt
|
||||
});
|
||||
|
||||
function write_cust_props(cp, opts)/*:string*/ {
|
||||
function write_cust_props(cp/*::, opts*/)/*:string*/ {
|
||||
var o = [XML_HEADER, CUST_PROPS_XML_ROOT];
|
||||
if(!cp) return o.join("");
|
||||
var pid = 1;
|
||||
|
@ -57,7 +57,7 @@ function xlml_write_docprops(Props, opts) {
|
||||
});
|
||||
return writextag('DocumentProperties', o.join(""), {xmlns:XLMLNS.o });
|
||||
}
|
||||
function xlml_write_custprops(Props, Custprops, opts) {
|
||||
function xlml_write_custprops(Props, Custprops/*::, opts*/) {
|
||||
var BLACKLIST = ["Worksheets","SheetNames"];
|
||||
var T = 'CustomDocumentProperties';
|
||||
var o/*:Array<string>*/ = [];
|
||||
|
@ -97,17 +97,6 @@ function parse_ClipboardData(blob) {
|
||||
return o;
|
||||
}
|
||||
|
||||
/* [MS-OLEPS] 2.14 Vector and Array Property Types */
|
||||
function parse_VtVector(blob, cb) {
|
||||
/* [MS-OLEPS] 2.14.2 VectorHeader */
|
||||
/* var Length = blob.read_shift(4);
|
||||
var o = [];
|
||||
for(var i = 0; i != Length; ++i) {
|
||||
o.push(cb(blob));
|
||||
}
|
||||
return o;*/
|
||||
}
|
||||
|
||||
/* [MS-OLEPS] 2.15 TypedPropertyValue */
|
||||
function parse_TypedPropertyValue(blob, type/*:number*/, _opts)/*:any*/ {
|
||||
var t = blob.read_shift(2), ret, opts = _opts||{};
|
||||
@ -131,17 +120,6 @@ function parse_TypedPropertyValue(blob, type/*:number*/, _opts)/*:any*/ {
|
||||
default: throw new Error("TypedPropertyValue unrecognized type " + type + " " + t);
|
||||
}
|
||||
}
|
||||
/* [MS-OLEPS] 2.14.2 VectorHeader */
|
||||
/*function parse_VTVectorVariant(blob) {
|
||||
var Length = blob.read_shift(4);
|
||||
|
||||
if(Length & 1 !== 0) throw new Error("VectorHeader Length=" + Length + " must be even");
|
||||
var o = [];
|
||||
for(var i = 0; i != Length; ++i) {
|
||||
o.push(parse_TypedPropertyValue(blob, VT_VARIANT));
|
||||
}
|
||||
return o;
|
||||
}*/
|
||||
|
||||
/* [MS-OLEPS] 2.20 PropertySet */
|
||||
function parse_PropertySet(blob, PIDSI) {
|
||||
@ -243,7 +221,7 @@ function parse_PropertySetStream(file, PIDSI) {
|
||||
var NumSets, FMTID0, FMTID1, Offset0, Offset1 = 0;
|
||||
blob.chk('feff', 'Byte Order: ');
|
||||
|
||||
var vers = blob.read_shift(2); // TODO: check version
|
||||
/*var vers = */blob.read_shift(2); // TODO: check version
|
||||
var SystemIdentifier = blob.read_shift(4);
|
||||
blob.chk(CFB.utils.consts.HEADER_CLSID, 'CLSID: ');
|
||||
NumSets = blob.read_shift(4);
|
||||
@ -303,14 +281,14 @@ function write_Bes(v, t/*:string*/, o) {
|
||||
/* [MS-XLS] 2.5.240 ShortXLUnicodeString */
|
||||
function parse_ShortXLUnicodeString(blob, length, opts) {
|
||||
var cch = blob.read_shift(opts && opts.biff >= 12 ? 2 : 1);
|
||||
var width = 1, encoding = 'sbcs-cont';
|
||||
var encoding = 'sbcs-cont';
|
||||
var cp = current_codepage;
|
||||
if(opts && opts.biff >= 8) current_codepage = 1200;
|
||||
if(!opts || opts.biff == 8 ) {
|
||||
var fHighByte = blob.read_shift(1);
|
||||
if(fHighByte) { width = 2; encoding = 'dbcs-cont'; }
|
||||
if(fHighByte) { encoding = 'dbcs-cont'; }
|
||||
} else if(opts.biff == 12) {
|
||||
width = 2; encoding = 'wstr';
|
||||
encoding = 'wstr';
|
||||
}
|
||||
if(opts.biff >= 2 && opts.biff <= 5) encoding = 'cpstr';
|
||||
var o = cch ? blob.read_shift(cch, encoding) : "";
|
||||
@ -323,7 +301,7 @@ function parse_XLUnicodeRichExtendedString(blob) {
|
||||
var cp = current_codepage;
|
||||
current_codepage = 1200;
|
||||
var cch = blob.read_shift(2), flags = blob.read_shift(1);
|
||||
var fHighByte = flags & 0x1, fExtSt = flags & 0x4, fRichSt = flags & 0x8;
|
||||
var /*fHighByte = flags & 0x1,*/ fExtSt = flags & 0x4, fRichSt = flags & 0x8;
|
||||
var width = 1 + (flags & 0x1); // 0x0 -> utf8, 0x1 -> dbcs
|
||||
var cRun = 0, cbExtRst;
|
||||
var z = {};
|
||||
@ -375,7 +353,7 @@ function write_XLUnicodeString(str, opts, o) {
|
||||
}
|
||||
|
||||
/* [MS-XLS] 2.5.61 ControlInfo */
|
||||
function parse_ControlInfo(blob, length, opts) {
|
||||
function parse_ControlInfo(blob/*::, length, opts*/) {
|
||||
var flags = blob.read_shift(1);
|
||||
blob.l++;
|
||||
var accel = blob.read_shift(2);
|
||||
@ -399,10 +377,10 @@ function parse_URLMoniker(blob/*::, length, opts*/) {
|
||||
}
|
||||
|
||||
/* [MS-OSHARED] 2.3.7.8 FileMoniker TODO: all fields */
|
||||
function parse_FileMoniker(blob, length) {
|
||||
var cAnti = blob.read_shift(2);
|
||||
function parse_FileMoniker(blob/*::, length*/) {
|
||||
blob.l += 2; //var cAnti = blob.read_shift(2);
|
||||
var ansiPath = blob.read_shift(0, 'lpstr-ansi');
|
||||
var endServer = blob.read_shift(2);
|
||||
blob.l += 2; //var endServer = blob.read_shift(2);
|
||||
if(blob.read_shift(2) != 0xDEAD) throw new Error("Bad FileMoniker");
|
||||
var sz = blob.read_shift(4);
|
||||
if(sz === 0) return ansiPath.replace(/\\/g,"/");
|
||||
@ -423,7 +401,7 @@ function parse_HyperlinkMoniker(blob, length) {
|
||||
}
|
||||
|
||||
/* [MS-OSHARED] 2.3.7.9 HyperlinkString */
|
||||
function parse_HyperlinkString(blob, length) {
|
||||
function parse_HyperlinkString(blob/*::, length*/) {
|
||||
var len = blob.read_shift(4);
|
||||
var o = len > 0 ? blob.read_shift(len, 'utf16le').replace(chr0, "") : "";
|
||||
return o;
|
||||
@ -436,19 +414,23 @@ function parse_Hyperlink(blob, length)/*:Hyperlink*/ {
|
||||
if(sVer !== 2) throw new Error("Unrecognized streamVersion: " + sVer);
|
||||
var flags = blob.read_shift(2);
|
||||
blob.l += 2;
|
||||
var displayName, targetFrameName, moniker, oleMoniker, Location="", guid, fileTime;
|
||||
var displayName, targetFrameName, moniker, oleMoniker, Loc="", guid, fileTime;
|
||||
if(flags & 0x0010) displayName = parse_HyperlinkString(blob, end - blob.l);
|
||||
if(flags & 0x0080) targetFrameName = parse_HyperlinkString(blob, end - blob.l);
|
||||
if((flags & 0x0101) === 0x0101) moniker = parse_HyperlinkString(blob, end - blob.l);
|
||||
if((flags & 0x0101) === 0x0001) oleMoniker = parse_HyperlinkMoniker(blob, end - blob.l);
|
||||
if(flags & 0x0008) Location = parse_HyperlinkString(blob, end - blob.l);
|
||||
if(flags & 0x0008) Loc = parse_HyperlinkString(blob, end - blob.l);
|
||||
if(flags & 0x0020) guid = blob.read_shift(16);
|
||||
if(flags & 0x0040) fileTime = parse_FILETIME(blob/*, 8*/);
|
||||
blob.l = end;
|
||||
var target = targetFrameName||moniker||oleMoniker||"";
|
||||
if(target && Location) target+="#"+Location;
|
||||
if(!target) target = "#" + Location;
|
||||
return {Target: target};
|
||||
if(target && Loc) target+="#"+Loc;
|
||||
if(!target) target = "#" + Loc;
|
||||
var out = ({Target:target}/*:any*/);
|
||||
if(guid) out.guid = guid;
|
||||
if(fileTime) out.time = fileTime;
|
||||
if(displayName) out.Tooltip = displayName;
|
||||
return out;
|
||||
}
|
||||
function write_Hyperlink(hl) {
|
||||
var out = new_buf(512), i = 0;
|
||||
@ -485,7 +467,7 @@ function write_Hyperlink(hl) {
|
||||
}
|
||||
|
||||
/* 2.5.178 LongRGBA */
|
||||
function parse_LongRGBA(blob, length) { var r = blob.read_shift(1), g = blob.read_shift(1), b = blob.read_shift(1), a = blob.read_shift(1); return [r,g,b,a]; }
|
||||
function parse_LongRGBA(blob/*::, length*/) { var r = blob.read_shift(1), g = blob.read_shift(1), b = blob.read_shift(1), a = blob.read_shift(1); return [r,g,b,a]; }
|
||||
|
||||
/* 2.5.177 LongRGB */
|
||||
function parse_LongRGB(blob, length) { var x = parse_LongRGBA(blob, length); x[3] = 0; return x; }
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* --- MS-XLS --- */
|
||||
|
||||
/* 2.5.19 */
|
||||
function parse_XLSCell(blob, length)/*:Cell*/ {
|
||||
function parse_XLSCell(blob/*::, length*/)/*:Cell*/ {
|
||||
var rw = blob.read_shift(2); // 0-indexed
|
||||
var col = blob.read_shift(2);
|
||||
var ixfe = blob.read_shift(2);
|
||||
@ -35,7 +35,7 @@ function parse_XTI(blob, length, opts) {
|
||||
}
|
||||
|
||||
/* 2.5.218 */
|
||||
function parse_RkRec(blob, length) {
|
||||
function parse_RkRec(blob) {
|
||||
var ixfe = blob.read_shift(2);
|
||||
var RK = parse_RkNumber(blob);
|
||||
return [ixfe, RK];
|
||||
@ -54,7 +54,7 @@ function parse_AddinUdf(blob, length, opts) {
|
||||
}
|
||||
|
||||
/* 2.5.209 TODO: Check sizes */
|
||||
function parse_Ref8U(blob, length) {
|
||||
function parse_Ref8U(blob/*::, length*/) {
|
||||
var rwFirst = blob.read_shift(2);
|
||||
var rwLast = blob.read_shift(2);
|
||||
var colFirst = blob.read_shift(2);
|
||||
@ -71,7 +71,7 @@ function write_Ref8U(r/*:Range*/, o) {
|
||||
}
|
||||
|
||||
/* 2.5.211 */
|
||||
function parse_RefU(blob, length) {
|
||||
function parse_RefU(blob/*::, length*/) {
|
||||
var rwFirst = blob.read_shift(2);
|
||||
var rwLast = blob.read_shift(2);
|
||||
var colFirst = blob.read_shift(1);
|
||||
@ -83,7 +83,7 @@ function parse_RefU(blob, length) {
|
||||
var parse_Ref = parse_RefU;
|
||||
|
||||
/* 2.5.143 */
|
||||
function parse_FtCmo(blob, length) {
|
||||
function parse_FtCmo(blob/*::, length*/) {
|
||||
blob.l += 4;
|
||||
var ot = blob.read_shift(2);
|
||||
var id = blob.read_shift(2);
|
||||
@ -93,7 +93,7 @@ function parse_FtCmo(blob, length) {
|
||||
}
|
||||
|
||||
/* 2.5.149 */
|
||||
function parse_FtNts(blob, length) {
|
||||
function parse_FtNts(blob) {
|
||||
var out = {};
|
||||
blob.l += 4;
|
||||
blob.l += 16; // GUID TODO
|
||||
@ -103,7 +103,7 @@ function parse_FtNts(blob, length) {
|
||||
}
|
||||
|
||||
/* 2.5.142 */
|
||||
function parse_FtCf(blob, length) {
|
||||
function parse_FtCf(blob) {
|
||||
var out = {};
|
||||
blob.l += 4;
|
||||
blob.cf = blob.read_shift(2);
|
||||
@ -111,7 +111,7 @@ function parse_FtCf(blob, length) {
|
||||
}
|
||||
|
||||
/* 2.5.140 - 2.5.154 and friends */
|
||||
function parse_FtSkip(blob, length) { blob.l += 2; blob.l += blob.read_shift(2); }
|
||||
function parse_FtSkip(blob) { blob.l += 2; blob.l += blob.read_shift(2); }
|
||||
var FtTab = {
|
||||
/*::[*/0x00/*::]*/: parse_FtSkip, /* FtEnd */
|
||||
/*::[*/0x04/*::]*/: parse_FtSkip, /* FtMacro */
|
||||
@ -133,7 +133,7 @@ var FtTab = {
|
||||
/*::[*/0x14/*::]*/: parse_FtSkip, /* FtCblsFmla */
|
||||
/*::[*/0x15/*::]*/: parse_FtCmo
|
||||
};
|
||||
function parse_FtArray(blob, length, ot) {
|
||||
function parse_FtArray(blob, length/*::, ot*/) {
|
||||
var tgt = blob.l + length;
|
||||
var fts = [];
|
||||
while(blob.l < tgt) {
|
||||
@ -194,8 +194,7 @@ function write_BOF(wb/*:Workbook*/, t/*:number*/, o) {
|
||||
/* 2.4.146 */
|
||||
function parse_InterfaceHdr(blob, length) {
|
||||
if(length === 0) return 0x04b0;
|
||||
var q;
|
||||
if((q=blob.read_shift(2))!==0x04b0){/* empty */}
|
||||
if((blob.read_shift(2))!==0x04b0){/* empty */}
|
||||
return 0x04b0;
|
||||
}
|
||||
|
||||
@ -205,7 +204,7 @@ function parse_WriteAccess(blob, length, opts) {
|
||||
if(opts.enc) { blob.l += length; return ""; }
|
||||
var l = blob.l;
|
||||
// TODO: make sure XLUnicodeString doesnt overrun
|
||||
var UserName = parse_XLUnicodeString(blob, 0, opts);
|
||||
var UserName = parse_XLUnicodeString2(blob, 0, opts);
|
||||
blob.read_shift(length + l - blob.l);
|
||||
return UserName;
|
||||
}
|
||||
@ -276,7 +275,7 @@ function parse_ExtSST(blob, length) {
|
||||
|
||||
|
||||
/* 2.4.221 TODO: check BIFF2-4 */
|
||||
function parse_Row(blob, length) {
|
||||
function parse_Row(blob) {
|
||||
var z = ({}/*:any*/);
|
||||
z.r = blob.read_shift(2);
|
||||
z.c = blob.read_shift(2);
|
||||
@ -294,7 +293,7 @@ function parse_Row(blob, length) {
|
||||
|
||||
|
||||
/* 2.4.125 */
|
||||
function parse_ForceFullCalculation(blob, length) {
|
||||
function parse_ForceFullCalculation(blob) {
|
||||
var header = parse_frtHeader(blob);
|
||||
if(header.type != 0x08A3) throw new Error("Invalid Future Record " + header.type);
|
||||
var fullcalc = blob.read_shift(4);
|
||||
@ -306,7 +305,7 @@ function parse_ForceFullCalculation(blob, length) {
|
||||
|
||||
|
||||
/* 2.4.215 rt */
|
||||
function parse_RecalcId(blob, length) {
|
||||
function parse_RecalcId(blob) {
|
||||
blob.read_shift(2);
|
||||
return blob.read_shift(4);
|
||||
}
|
||||
@ -326,14 +325,14 @@ function parse_DefaultRowHeight(blob, length, opts) {
|
||||
}
|
||||
|
||||
/* 2.4.345 TODO */
|
||||
function parse_Window1(blob, length) {
|
||||
function parse_Window1(blob) {
|
||||
var xWn = blob.read_shift(2), yWn = blob.read_shift(2), dxWn = blob.read_shift(2), dyWn = blob.read_shift(2);
|
||||
var flags = blob.read_shift(2), iTabCur = blob.read_shift(2), iTabFirst = blob.read_shift(2);
|
||||
var ctabSel = blob.read_shift(2), wTabRatio = blob.read_shift(2);
|
||||
return { Pos: [xWn, yWn], Dim: [dxWn, dyWn], Flags: flags, CurTab: iTabCur,
|
||||
FirstTab: iTabFirst, Selected: ctabSel, TabRatio: wTabRatio };
|
||||
}
|
||||
function write_Window1(opts) {
|
||||
function write_Window1(/*::opts*/) {
|
||||
var o = new_buf(18);
|
||||
o.write_shift(2, 0);
|
||||
o.write_shift(2, 0);
|
||||
@ -379,7 +378,7 @@ function parse_Font(blob, length, opts) {
|
||||
}
|
||||
|
||||
/* 2.4.149 */
|
||||
function parse_LabelSst(blob, length) {
|
||||
function parse_LabelSst(blob) {
|
||||
var cell = parse_XLSCell(blob);
|
||||
cell.isst = blob.read_shift(4);
|
||||
return cell;
|
||||
@ -434,7 +433,7 @@ function write_Dimensions(range, opts) {
|
||||
}
|
||||
|
||||
/* 2.4.220 */
|
||||
function parse_RK(blob, length) {
|
||||
function parse_RK(blob) {
|
||||
var rw = blob.read_shift(2), col = blob.read_shift(2);
|
||||
var rkrec = parse_RkRec(blob);
|
||||
return {r:rw, c:col, ixfe:rkrec[0], rknum:rkrec[1]};
|
||||
@ -504,8 +503,8 @@ function parse_CellStyleXF(blob, length, style, opts) {
|
||||
o.fsxButton = (d >> 14) & 0x01;
|
||||
return o;
|
||||
}
|
||||
function parse_CellXF(blob, length, opts) {return parse_CellStyleXF(blob,length,0, opts);}
|
||||
function parse_StyleXF(blob, length, opts) {return parse_CellStyleXF(blob,length,1, opts);}
|
||||
//function parse_CellXF(blob, length, opts) {return parse_CellStyleXF(blob,length,0, opts);}
|
||||
//function parse_StyleXF(blob, length, opts) {return parse_CellStyleXF(blob,length,1, opts);}
|
||||
|
||||
/* 2.4.353 TODO: actually do this right */
|
||||
function parse_XF(blob, length, opts) {
|
||||
@ -518,7 +517,7 @@ function parse_XF(blob, length, opts) {
|
||||
}
|
||||
|
||||
/* 2.4.134 */
|
||||
function parse_Guts(blob, length) {
|
||||
function parse_Guts(blob) {
|
||||
blob.l += 4;
|
||||
var out = [blob.read_shift(2), blob.read_shift(2)];
|
||||
if(out[0] !== 0) out[0]--;
|
||||
@ -551,13 +550,13 @@ function write_BoolErr(R/*:number*/, C/*:number*/, v, opts, t/*:string*/) {
|
||||
}
|
||||
|
||||
/* 2.4.180 Number */
|
||||
function parse_Number(blob, length) {
|
||||
function parse_Number(blob) {
|
||||
var cell = parse_XLSCell(blob, 6);
|
||||
var xnum = parse_Xnum(blob, 8);
|
||||
cell.val = xnum;
|
||||
return cell;
|
||||
}
|
||||
function write_Number(R/*:number*/, C/*:number*/, v, opts) {
|
||||
function write_Number(R/*:number*/, C/*:number*/, v/*::, opts*/) {
|
||||
var o = new_buf(14);
|
||||
write_XLSCell(R, C, 0, o);
|
||||
write_Xnum(v, o);
|
||||
@ -649,6 +648,7 @@ function parse_ExternSheet(blob, length, opts) {
|
||||
var o = [], target = blob.l + length, len = blob.read_shift(opts.biff > 8 ? 4 : 2);
|
||||
while(len-- !== 0) o.push(parse_XTI(blob, opts.biff > 8 ? 12 : 6, opts));
|
||||
// [iSupBook, itabFirst, itabLast];
|
||||
if(blob.l != target) throw new Error("Bad ExternSheet: " + blob.l + " != " + target);
|
||||
return o;
|
||||
}
|
||||
function parse_BIFF5ExternSheet(blob, length, opts) {
|
||||
@ -689,7 +689,7 @@ function parse_Array(blob, length, opts) {
|
||||
}
|
||||
|
||||
/* 2.4.173 */
|
||||
function parse_MTRSettings(blob, length) {
|
||||
function parse_MTRSettings(blob) {
|
||||
var fMTREnabled = blob.read_shift(4) !== 0x00;
|
||||
var fUserSetThreadCount = blob.read_shift(4) !== 0x00;
|
||||
var cUserThreadCount = blob.read_shift(4);
|
||||
@ -735,14 +735,14 @@ function parse_Obj(blob, length, opts) {
|
||||
}
|
||||
/* from older spec */
|
||||
var parse_BIFF5OT = [];
|
||||
parse_BIFF5OT[0x08] = function(blob, length, opts) {
|
||||
parse_BIFF5OT[0x08] = function(blob, length) {
|
||||
var tgt = blob.l + length;
|
||||
blob.l += 10; // todo
|
||||
var cf = blob.read_shift(2);
|
||||
blob.l += 4;
|
||||
var cbPictFmla = blob.read_shift(2);
|
||||
blob.l += 2; //var cbPictFmla = blob.read_shift(2);
|
||||
blob.l += 2;
|
||||
var grbit = blob.read_shift(2);
|
||||
blob.l += 2; //var grbit = blob.read_shift(2);
|
||||
blob.l += 4;
|
||||
var cchName = blob.read_shift(1);
|
||||
blob.l += cchName; // TODO: stName
|
||||
@ -751,19 +751,19 @@ parse_BIFF5OT[0x08] = function(blob, length, opts) {
|
||||
};
|
||||
|
||||
function parse_BIFF5Obj(blob, length, opts) {
|
||||
var cnt = blob.read_shift(4);
|
||||
blob.l += 4; //var cnt = blob.read_shift(4);
|
||||
var ot = blob.read_shift(2);
|
||||
var id = blob.read_shift(2);
|
||||
var grbit = blob.read_shift(2);
|
||||
var colL = blob.read_shift(2);
|
||||
var dxL = blob.read_shift(2);
|
||||
var rwT = blob.read_shift(2);
|
||||
var dyT = blob.read_shift(2);
|
||||
var colR = blob.read_shift(2);
|
||||
var dxR = blob.read_shift(2);
|
||||
var rwB = blob.read_shift(2);
|
||||
var dyB = blob.read_shift(2);
|
||||
var cbMacro = blob.read_shift(2);
|
||||
blob.l += 2; //var colL = blob.read_shift(2);
|
||||
blob.l += 2; //var dxL = blob.read_shift(2);
|
||||
blob.l += 2; //var rwT = blob.read_shift(2);
|
||||
blob.l += 2; //var dyT = blob.read_shift(2);
|
||||
blob.l += 2; //var colR = blob.read_shift(2);
|
||||
blob.l += 2; //var dxR = blob.read_shift(2);
|
||||
blob.l += 2; //var rwB = blob.read_shift(2);
|
||||
blob.l += 2; //var dyB = blob.read_shift(2);
|
||||
blob.l += 2; //var cbMacro = blob.read_shift(2);
|
||||
blob.l += 6;
|
||||
length -= 36;
|
||||
var fts = [];
|
||||
@ -778,12 +778,12 @@ function parse_TxO(blob, length, opts) {
|
||||
try {
|
||||
blob.l += 4;
|
||||
var ot = (opts.lastobj||{cmo:[0,0]}).cmo[1];
|
||||
var controlInfo;
|
||||
var controlInfo; // eslint-disable-line no-unused-vars
|
||||
if([0,5,7,11,12,14].indexOf(ot) == -1) blob.l += 6;
|
||||
else controlInfo = parse_ControlInfo(blob, 6, opts);
|
||||
var cchText = blob.read_shift(2);
|
||||
var cbRuns = blob.read_shift(2);
|
||||
var ifntEmpty = parseuint16(blob, 2);
|
||||
/*var cbRuns = */blob.read_shift(2);
|
||||
/*var ifntEmpty = */parseuint16(blob, 2);
|
||||
var len = blob.read_shift(2);
|
||||
blob.l += len;
|
||||
//var fmla = parse_ObjFmla(blob, s + length - blob.l);
|
||||
@ -831,7 +831,6 @@ function write_HLink(hl) {
|
||||
|
||||
/* 2.4.141 */
|
||||
function parse_HLinkTooltip(blob, length) {
|
||||
var end = blob.l + length;
|
||||
blob.read_shift(2);
|
||||
var ref = parse_Ref8U(blob, 8);
|
||||
var wzTooltip = blob.read_shift((length-10)/2, 'dbcs-cont');
|
||||
@ -851,7 +850,7 @@ function write_HLinkTooltip(hl) {
|
||||
}
|
||||
|
||||
/* 2.4.63 */
|
||||
function parse_Country(blob, length)/*:[string|number, string|number]*/ {
|
||||
function parse_Country(blob)/*:[string|number, string|number]*/ {
|
||||
var o = [0,0], d;
|
||||
d = blob.read_shift(2); o[0] = CountryEnum[d] || d;
|
||||
d = blob.read_shift(2); o[1] = CountryEnum[d] || d;
|
||||
@ -865,7 +864,7 @@ function write_Country(o) {
|
||||
}
|
||||
|
||||
/* 2.4.50 ClrtClient */
|
||||
function parse_ClrtClient(blob, length) {
|
||||
function parse_ClrtClient(blob) {
|
||||
var ccv = blob.read_shift(2);
|
||||
var o = [];
|
||||
while(ccv-->0) o.push(parse_LongRGB(blob, 8));
|
||||
@ -873,7 +872,7 @@ function parse_ClrtClient(blob, length) {
|
||||
}
|
||||
|
||||
/* 2.4.188 */
|
||||
function parse_Palette(blob, length) {
|
||||
function parse_Palette(blob) {
|
||||
var ccv = blob.read_shift(2);
|
||||
var o = [];
|
||||
while(ccv-->0) o.push(parse_LongRGB(blob, 8));
|
||||
@ -881,7 +880,7 @@ function parse_Palette(blob, length) {
|
||||
}
|
||||
|
||||
/* 2.4.354 */
|
||||
function parse_XFCRC(blob, length) {
|
||||
function parse_XFCRC(blob) {
|
||||
blob.l += 2;
|
||||
var o = {cxfs:0, crc:0};
|
||||
o.cxfs = blob.read_shift(2);
|
||||
@ -904,7 +903,7 @@ function parse_ColInfo(blob, length, opts) {
|
||||
}
|
||||
|
||||
/* 2.4.257 */
|
||||
function parse_Setup(blob, length, opts) {
|
||||
function parse_Setup(blob/*, length*/) {
|
||||
var o = {};
|
||||
blob.l += 16;
|
||||
o.header = parse_Xnum(blob, 8);
|
||||
@ -934,8 +933,7 @@ var parse_Scl = parseuint16a; /* 2.4.247 num, den */
|
||||
var parse_String = parse_XLUnicodeString; /* 2.4.268 */
|
||||
|
||||
/* --- Specific to versions before BIFF8 --- */
|
||||
function parse_ImData(blob, length, opts) {
|
||||
var tgt = blob.l + length;
|
||||
function parse_ImData(blob) {
|
||||
var cf = blob.read_shift(2);
|
||||
var env = blob.read_shift(2);
|
||||
var lcb = blob.read_shift(4);
|
||||
@ -944,11 +942,6 @@ function parse_ImData(blob, length, opts) {
|
||||
return o;
|
||||
}
|
||||
|
||||
function parse_BIFF5String(blob) {
|
||||
var len = blob.read_shift(1);
|
||||
return blob.read_shift(len, 'sbcs-cont');
|
||||
}
|
||||
|
||||
/* BIFF2_??? where ??? is the name from [XLS] */
|
||||
function parse_BIFF2STR(blob, length, opts) {
|
||||
var cell = parse_XLSCell(blob, 6);
|
||||
@ -959,7 +952,7 @@ function parse_BIFF2STR(blob, length, opts) {
|
||||
return cell;
|
||||
}
|
||||
|
||||
function parse_BIFF2NUM(blob, length, opts) {
|
||||
function parse_BIFF2NUM(blob/*::, length*/) {
|
||||
var cell = parse_XLSCell(blob, 6);
|
||||
++blob.l;
|
||||
var num = parse_Xnum(blob, 8);
|
||||
@ -974,7 +967,7 @@ function write_BIFF2NUM(r/*:number*/, c/*:number*/, val/*:number*/) {
|
||||
return out;
|
||||
}
|
||||
|
||||
function parse_BIFF2INT(blob, length) {
|
||||
function parse_BIFF2INT(blob) {
|
||||
var cell = parse_XLSCell(blob, 6);
|
||||
++blob.l;
|
||||
var num = blob.read_shift(2);
|
||||
@ -989,7 +982,7 @@ function write_BIFF2INT(r/*:number*/, c/*:number*/, val/*:number*/) {
|
||||
return out;
|
||||
}
|
||||
|
||||
function parse_BIFF2STRING(blob, length) {
|
||||
function parse_BIFF2STRING(blob) {
|
||||
var cch = blob.read_shift(1);
|
||||
if(cch === 0) { blob.l++; return ""; }
|
||||
return blob.read_shift(cch, 'sbcs-cont');
|
||||
|
@ -66,17 +66,17 @@ function dbf_to_aoa(buf, opts)/*:AOA*/ {
|
||||
case 0xF5: memo = true; break;
|
||||
default: throw new Error("DBF Unsupported Version: " + ft.toString(16));
|
||||
}
|
||||
var filedate = new Date(), nrow = 0, fpos = 0;
|
||||
var /*filedate = new Date(),*/ nrow = 0, fpos = 0;
|
||||
if(ft == 0x02) nrow = d.read_shift(2);
|
||||
filedate = new Date(d.read_shift(1) + 1900, d.read_shift(1) - 1, d.read_shift(1));
|
||||
/*filedate = new Date(d.read_shift(1) + 1900, d.read_shift(1) - 1, d.read_shift(1));*/d.l += 3;
|
||||
if(ft != 0x02) nrow = d.read_shift(4);
|
||||
if(ft != 0x02) fpos = d.read_shift(2);
|
||||
var rlen = d.read_shift(2);
|
||||
|
||||
var flags = 0, current_cp = 1252;
|
||||
var /*flags = 0,*/ current_cp = 1252;
|
||||
if(ft != 0x02) {
|
||||
d.l+=16;
|
||||
flags = d.read_shift(1);
|
||||
/*flags = */d.read_shift(1);
|
||||
//if(memo && ((flags & 0x02) === 0)) throw new Error("DBF Flags " + flags.toString(16) + " ft " + ft.toString(16));
|
||||
|
||||
/* codepage present in FoxPro */
|
||||
@ -407,7 +407,7 @@ var SYLK = (function() {
|
||||
|
||||
function sylk_to_workbook(d/*:RawData*/, opts)/*:Workbook*/ { return sheet_to_workbook(sylk_to_sheet(d, opts), opts); }
|
||||
|
||||
function write_ws_cell_sylk(cell/*:Cell*/, ws/*:Worksheet*/, R/*:number*/, C/*:number*/, opts)/*:string*/ {
|
||||
function write_ws_cell_sylk(cell/*:Cell*/, ws/*:Worksheet*/, R/*:number*/, C/*:number*//*::, opts*/)/*:string*/ {
|
||||
var o = "C;Y" + (R+1) + ";X" + (C+1) + ";K";
|
||||
switch(cell.t) {
|
||||
case 'n':
|
||||
@ -484,7 +484,7 @@ var DIF = (function() {
|
||||
}
|
||||
throw new Error("Unrecognized type " + opts.type);
|
||||
}
|
||||
function dif_to_aoa_str(str/*:string*/, opts)/*:AOA*/ {
|
||||
function dif_to_aoa_str(str/*:string*//*::, opts*/)/*:AOA*/ {
|
||||
var records = str.split('\n'), R = -1, C = -1, ri = 0, arr/*:AOA*/ = [];
|
||||
for (; ri !== records.length; ++ri) {
|
||||
if (records[ri].trim() === 'BOT') { arr[++R] = []; C = 0; continue; }
|
||||
@ -528,7 +528,7 @@ var DIF = (function() {
|
||||
o.push(type + "," + v);
|
||||
o.push(type == 1 ? '"' + s.replace(/"/g,'""') + '"' : s);
|
||||
};
|
||||
return function sheet_to_dif(ws/*:Worksheet*/, opts/*:?any*/)/*:string*/ {
|
||||
return function sheet_to_dif(ws/*:Worksheet*//*::, opts:?any*/)/*:string*/ {
|
||||
var o/*:Array<string>*/ = [];
|
||||
var r = safe_decode_range(ws['!ref']), cell/*:Cell*/;
|
||||
var dense = Array.isArray(ws);
|
||||
@ -585,7 +585,7 @@ var ETH = (function() {
|
||||
function decode(s/*:string*/)/*:string*/ { return s.replace(/\\b/g,"\\").replace(/\\c/g,":").replace(/\\n/g,"\n"); }
|
||||
function encode(s/*:string*/)/*:string*/ { return s.replace(/\\/g, "\\b").replace(/:/g, "\\c").replace(/\n/g,"\\n"); }
|
||||
|
||||
function eth_to_aoa(str/*:string*/, opts)/*:AOA*/ {
|
||||
function eth_to_aoa(str/*:string*//*::, opts*/)/*:AOA*/ {
|
||||
var records = str.split('\n'), R = -1, C = -1, ri = 0, arr/*:AOA*/ = [];
|
||||
for (; ri !== records.length; ++ri) {
|
||||
var record = records[ri].trim().split(":");
|
||||
@ -668,7 +668,7 @@ var ETH = (function() {
|
||||
return o.join("\n");
|
||||
}
|
||||
|
||||
function sheet_to_eth(ws/*:Worksheet*/, opts/*:?any*/)/*:string*/ {
|
||||
function sheet_to_eth(ws/*:Worksheet*//*::, opts:?any*/)/*:string*/ {
|
||||
return [header, sep, meta, sep, sheet_to_eth_data(ws), end].join("\n");
|
||||
// return ["version:1.5", sheet_to_eth_data(ws)].join("\n"); // clipboard form
|
||||
}
|
||||
@ -836,7 +836,7 @@ var PRN = (function() {
|
||||
|
||||
function prn_to_workbook(d/*:RawData*/, opts)/*:Workbook*/ { return sheet_to_workbook(prn_to_sheet(d, opts), opts); }
|
||||
|
||||
function sheet_to_prn(ws/*:Worksheet*/, opts/*:?any*/)/*:string*/ {
|
||||
function sheet_to_prn(ws/*:Worksheet*//*::, opts:?any*/)/*:string*/ {
|
||||
var o/*:Array<string>*/ = [];
|
||||
var r = safe_decode_range(ws['!ref']), cell/*:Cell*/;
|
||||
var dense = Array.isArray(ws);
|
||||
|
@ -95,7 +95,7 @@ var WK_ = (function() {
|
||||
return { SheetNames: snames, Sheets:sheets };
|
||||
}
|
||||
|
||||
function parse_RANGE(blob, length) {
|
||||
function parse_RANGE(blob) {
|
||||
var o = {s:{c:0,r:0},e:{c:0,r:0}};
|
||||
o.s.c = blob.read_shift(2);
|
||||
o.s.r = blob.read_shift(2);
|
||||
@ -159,7 +159,7 @@ var WK_ = (function() {
|
||||
return o;
|
||||
}
|
||||
|
||||
function parse_cell_3(blob, length) {
|
||||
function parse_cell_3(blob/*::, length*/) {
|
||||
var o = [{c:0,r:0}, {t:'n',v:0}, 0];
|
||||
o[0].r = blob.read_shift(2); o[3] = blob[blob.l++]; o[0].c = blob[blob.l++];
|
||||
return o;
|
||||
@ -198,7 +198,7 @@ var WK_ = (function() {
|
||||
var e = blob.read_shift(2);
|
||||
if(e == 0xFFFF) { o[1].v = 0; return o; }
|
||||
var s = e & 0x8000; e = (e&0x7FFF) - 16446;
|
||||
o[1].v = ((e > 0 ? (v2 << e) : (v2 >>> -e)) + (e > -32 ? (v1 << (e + 32)) : (v1 >>> -(e + 32))));
|
||||
o[1].v = (s*2 - 1) * ((e > 0 ? (v2 << e) : (v2 >>> -e)) + (e > -32 ? (v1 << (e + 32)) : (v1 >>> -(e + 32))));
|
||||
return o;
|
||||
}
|
||||
|
||||
|
@ -123,12 +123,12 @@ var parse_rs = (function parse_rs_factory() {
|
||||
function parse_r(r) {
|
||||
var terms/*:[Array<string>, string, Array<string>]*/ = [[],"",[]];
|
||||
/* 18.4.12 t ST_Xstring */
|
||||
var t = r.match(tregex), cp = 65001;
|
||||
var t = r.match(tregex)/*, cp = 65001*/;
|
||||
if(!t) return "";
|
||||
terms[1] = t[1];
|
||||
|
||||
var rpr = r.match(rpregex);
|
||||
if(rpr) cp = parse_rpr(rpr[1], terms[0], terms[2]);
|
||||
if(rpr) /*cp = */parse_rpr(rpr[1], terms[0], terms[2]);
|
||||
|
||||
return terms[0].join("") + terms[1].replace(nlregex,'<br/>') + terms[2].join("");
|
||||
}
|
||||
@ -144,7 +144,7 @@ function parse_si(x, opts) {
|
||||
var html = opts ? opts.cellHTML : true;
|
||||
var z = {};
|
||||
if(!x) return null;
|
||||
var y;
|
||||
//var y;
|
||||
/* 18.4.12 t ST_Xstring (Plaintext String) */
|
||||
// TODO: is whitespace actually valid here?
|
||||
if(x.match(/^\s*<(?:\w+:)?t[^>]*>/)) {
|
||||
@ -153,7 +153,7 @@ function parse_si(x, opts) {
|
||||
if(html) z.h = escapehtml(z.t);
|
||||
}
|
||||
/* 18.4.4 r CT_RElt (Rich Text Run) */
|
||||
else if((y = x.match(sirregex))) {
|
||||
else if((/*y = */x.match(sirregex))) {
|
||||
z.r = utf8read(x);
|
||||
z.t = unescapexml(utf8read((x.replace(sirphregex, '').match(sitregex)||[]).join("").replace(tagregex,"")));
|
||||
if(html) z.h = parse_rs(z.r);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* [MS-XLSB] 2.4.219 BrtBeginSst */
|
||||
function parse_BrtBeginSst(data, length) {
|
||||
function parse_BrtBeginSst(data) {
|
||||
return [data.read_shift(4), data.read_shift(4)];
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ function write_BrtBeginSst(sst, o) {
|
||||
|
||||
var write_BrtSSTItem = write_RichStr;
|
||||
|
||||
function write_sst_bin(sst, opts) {
|
||||
function write_sst_bin(sst/*::, opts*/) {
|
||||
var ba = buf_array();
|
||||
write_record(ba, "BrtBeginSst", write_BrtBeginSst(sst));
|
||||
for(var i = 0; i < sst.length; ++i) write_record(ba, "BrtSSTItem", write_BrtSSTItem(sst[i]));
|
||||
|
@ -16,7 +16,7 @@ function parse_CRYPTOVersion(blob, length/*:?number*/) {
|
||||
}
|
||||
|
||||
/* [MS-OFFCRYPTO] 2.1.5 DataSpaceVersionInfo */
|
||||
function parse_DataSpaceVersionInfo(blob, length) {
|
||||
function parse_DataSpaceVersionInfo(blob) {
|
||||
var o = {};
|
||||
o.id = blob.read_shift(0, 'lpp4');
|
||||
o.R = parse_CRYPTOVersion(blob, 4);
|
||||
@ -41,7 +41,7 @@ function parse_DataSpaceMapEntry(blob) {
|
||||
}
|
||||
|
||||
/* [MS-OFFCRYPTO] 2.1.6 DataSpaceMap */
|
||||
function parse_DataSpaceMap(blob, length) {
|
||||
function parse_DataSpaceMap(blob) {
|
||||
var o = [];
|
||||
blob.l += 4; // must be 0x8
|
||||
var cnt = blob.read_shift(4);
|
||||
@ -50,7 +50,7 @@ function parse_DataSpaceMap(blob, length) {
|
||||
}
|
||||
|
||||
/* [MS-OFFCRYPTO] 2.1.7 DataSpaceDefinition */
|
||||
function parse_DataSpaceDefinition(blob, length)/*:Array<string>*/ {
|
||||
function parse_DataSpaceDefinition(blob)/*:Array<string>*/ {
|
||||
var o/*:Array<string>*/ = [];
|
||||
blob.l += 4; // must be 0x8
|
||||
var cnt = blob.read_shift(4);
|
||||
@ -59,9 +59,9 @@ function parse_DataSpaceDefinition(blob, length)/*:Array<string>*/ {
|
||||
}
|
||||
|
||||
/* [MS-OFFCRYPTO] 2.1.8 DataSpaceDefinition */
|
||||
function parse_TransformInfoHeader(blob, length) {
|
||||
function parse_TransformInfoHeader(blob) {
|
||||
var o = {};
|
||||
var len = blob.read_shift(4);
|
||||
/*var len = */blob.read_shift(4);
|
||||
blob.l += 4; // must be 0x1
|
||||
o.id = blob.read_shift(0, 'lpp4');
|
||||
o.name = blob.read_shift(0, 'lpp4');
|
||||