2015-04-02 20:32:22 +00:00
|
|
|
var attregexg2=/([\w:]+)=((?:")([^"]*)(?:")|(?:')([^']*)(?:'))/g;
|
|
|
|
var attregex2=/([\w:]+)=((?:")(?:[^"]*)(?:")|(?:')(?:[^']*)(?:'))/;
|
2017-02-10 19:23:01 +00:00
|
|
|
function xlml_parsexmltag(tag/*:string*/, skip_root/*:?boolean*/) {
|
2015-04-02 20:32:22 +00:00
|
|
|
var words = tag.split(/\s+/);
|
2017-02-10 19:23:01 +00:00
|
|
|
var z/*:any*/ = ([]/*:any*/); if(!skip_root) z[0] = words[0];
|
2015-04-02 20:32:22 +00:00
|
|
|
if(words.length === 1) return z;
|
|
|
|
var m = tag.match(attregexg2), y, j, w, i;
|
|
|
|
if(m) for(i = 0; i != m.length; ++i) {
|
|
|
|
y = m[i].match(attregex2);
|
2017-02-10 19:23:01 +00:00
|
|
|
/*:: if(!y || !y[2]) continue; */
|
2018-01-11 08:01:25 +00:00
|
|
|
if((j=y[1].indexOf(":")) === -1) z[y[1]] = y[2].slice(1,y[2].length-1);
|
2015-04-02 20:32:22 +00:00
|
|
|
else {
|
2018-01-11 08:01:25 +00:00
|
|
|
if(y[1].slice(0,6) === "xmlns:") w = "xmlns"+y[1].slice(6);
|
|
|
|
else w = y[1].slice(j+1);
|
|
|
|
z[w] = y[2].slice(1,y[2].length-1);
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return z;
|
|
|
|
}
|
2017-02-10 19:23:01 +00:00
|
|
|
function xlml_parsexmltagobj(tag/*:string*/) {
|
2015-04-02 20:32:22 +00:00
|
|
|
var words = tag.split(/\s+/);
|
|
|
|
var z = {};
|
|
|
|
if(words.length === 1) return z;
|
|
|
|
var m = tag.match(attregexg2), y, j, w, i;
|
|
|
|
if(m) for(i = 0; i != m.length; ++i) {
|
|
|
|
y = m[i].match(attregex2);
|
2017-02-10 19:23:01 +00:00
|
|
|
/*:: if(!y || !y[2]) continue; */
|
2018-01-11 08:01:25 +00:00
|
|
|
if((j=y[1].indexOf(":")) === -1) z[y[1]] = y[2].slice(1,y[2].length-1);
|
2015-04-02 20:32:22 +00:00
|
|
|
else {
|
2018-01-11 08:01:25 +00:00
|
|
|
if(y[1].slice(0,6) === "xmlns:") w = "xmlns"+y[1].slice(6);
|
|
|
|
else w = y[1].slice(j+1);
|
|
|
|
z[w] = y[2].slice(1,y[2].length-1);
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return z;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ----
|
|
|
|
|
2017-02-10 19:23:01 +00:00
|
|
|
function xlml_format(format, value)/*:string*/ {
|
2015-04-02 20:32:22 +00:00
|
|
|
var fmt = XLMLFormatMap[format] || unescapexml(format);
|
|
|
|
if(fmt === "General") return SSF._general(value);
|
|
|
|
return SSF.format(fmt, value);
|
|
|
|
}
|
|
|
|
|
2017-12-30 05:40:35 +00:00
|
|
|
function xlml_set_custprop(Custprops, key, cp, val/*:string*/) {
|
2017-03-12 18:02:43 +00:00
|
|
|
var oval/*:any*/ = val;
|
2015-04-02 20:32:22 +00:00
|
|
|
switch((cp[0].match(/dt:dt="([\w.]+)"/)||["",""])[1]) {
|
2017-03-12 18:02:43 +00:00
|
|
|
case "boolean": oval = parsexmlbool(val); break;
|
|
|
|
case "i2": case "int": oval = parseInt(val, 10); break;
|
|
|
|
case "r4": case "float": oval = parseFloat(val); break;
|
2017-03-23 01:18:40 +00:00
|
|
|
case "date": case "dateTime.tz": oval = parseDate(val); break;
|
2015-04-02 20:32:22 +00:00
|
|
|
case "i8": case "string": case "fixed": case "uuid": case "bin.base64": break;
|
2017-03-12 18:02:43 +00:00
|
|
|
default: throw new Error("bad custprop:" + cp[0]);
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
2017-12-30 05:40:35 +00:00
|
|
|
Custprops[unescapexml(key)] = oval;
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
|
|
|
|
2017-02-10 19:23:01 +00:00
|
|
|
function safe_format_xlml(cell/*:Cell*/, nf, o) {
|
2017-03-15 08:19:02 +00:00
|
|
|
if(cell.t === 'z') return;
|
2017-04-21 22:02:02 +00:00
|
|
|
if(!o || o.cellText !== false) try {
|
2015-04-02 20:32:22 +00:00
|
|
|
if(cell.t === 'e') { cell.w = cell.w || BErr[cell.v]; }
|
|
|
|
else if(nf === "General") {
|
|
|
|
if(cell.t === 'n') {
|
2022-03-17 04:38:06 +00:00
|
|
|
if((cell.v|0) === cell.v) cell.w = cell.v.toString(10);
|
2015-04-02 20:32:22 +00:00
|
|
|
else cell.w = SSF._general_num(cell.v);
|
|
|
|
}
|
|
|
|
else cell.w = SSF._general(cell.v);
|
|
|
|
}
|
|
|
|
else cell.w = xlml_format(nf||"General", cell.v);
|
2017-04-21 22:02:02 +00:00
|
|
|
} catch(e) { if(o.WTF) throw e; }
|
|
|
|
try {
|
2017-03-21 20:44:35 +00:00
|
|
|
var z = XLMLFormatMap[nf]||nf||"General";
|
|
|
|
if(o.cellNF) cell.z = z;
|
|
|
|
if(o.cellDates && cell.t == 'n' && SSF.is_date(z)) {
|
2017-06-01 21:22:11 +00:00
|
|
|
var _d = SSF.parse_date_code(cell.v); if(_d) { cell.t = 'd'; cell.v = new Date(_d.y, _d.m-1,_d.d,_d.H,_d.M,_d.S,_d.u); }
|
2017-03-21 20:44:35 +00:00
|
|
|
}
|
2015-04-02 20:32:22 +00:00
|
|
|
} catch(e) { if(o.WTF) throw e; }
|
|
|
|
}
|
|
|
|
|
|
|
|
function process_style_xlml(styles, stag, opts) {
|
|
|
|
if(opts.cellStyles) {
|
|
|
|
if(stag.Interior) {
|
|
|
|
var I = stag.Interior;
|
|
|
|
if(I.Pattern) I.patternType = XLMLPatternTypeMap[I.Pattern] || I.Pattern;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
styles[stag.ID] = stag;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* TODO: there must exist some form of OSP-blessed spec */
|
2017-03-12 18:02:43 +00:00
|
|
|
function parse_xlml_data(xml, ss, data, cell/*:any*/, base, styles, csty, row, arrayf, o) {
|
2015-04-02 20:32:22 +00:00
|
|
|
var nf = "General", sid = cell.StyleID, S = {}; o = o || {};
|
|
|
|
var interiors = [];
|
2017-03-10 01:09:18 +00:00
|
|
|
var i = 0;
|
2015-04-02 20:32:22 +00:00
|
|
|
if(sid === undefined && row) sid = row.StyleID;
|
|
|
|
if(sid === undefined && csty) sid = csty.StyleID;
|
|
|
|
while(styles[sid] !== undefined) {
|
|
|
|
if(styles[sid].nf) nf = styles[sid].nf;
|
|
|
|
if(styles[sid].Interior) interiors.push(styles[sid].Interior);
|
|
|
|
if(!styles[sid].Parent) break;
|
|
|
|
sid = styles[sid].Parent;
|
|
|
|
}
|
|
|
|
switch(data.Type) {
|
|
|
|
case 'Boolean':
|
|
|
|
cell.t = 'b';
|
|
|
|
cell.v = parsexmlbool(xml);
|
|
|
|
break;
|
|
|
|
case 'String':
|
|
|
|
cell.t = 's'; cell.r = xlml_fixstr(unescapexml(xml));
|
2020-03-18 06:47:02 +00:00
|
|
|
cell.v = (xml.indexOf("<") > -1 ? unescapexml(ss||xml).replace(/<.*?>/g, "") : cell.r); // todo: BR etc
|
2015-04-02 20:32:22 +00:00
|
|
|
break;
|
|
|
|
case 'DateTime':
|
2017-05-17 04:23:36 +00:00
|
|
|
if(xml.slice(-1) != "Z") xml += "Z";
|
2017-03-23 01:18:40 +00:00
|
|
|
cell.v = (parseDate(xml) - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
|
2015-04-02 20:32:22 +00:00
|
|
|
if(cell.v !== cell.v) cell.v = unescapexml(xml);
|
2017-03-18 00:45:06 +00:00
|
|
|
else if(cell.v<60) cell.v = cell.v -1;
|
2015-04-02 20:32:22 +00:00
|
|
|
if(!nf || nf == "General") nf = "yyyy-mm-dd";
|
|
|
|
/* falls through */
|
|
|
|
case 'Number':
|
|
|
|
if(cell.v === undefined) cell.v=+xml;
|
|
|
|
if(!cell.t) cell.t = 'n';
|
|
|
|
break;
|
2017-04-26 02:27:12 +00:00
|
|
|
case 'Error': cell.t = 'e'; cell.v = RBErr[xml]; if(o.cellText !== false) cell.w = xml; break;
|
2020-03-15 07:42:05 +00:00
|
|
|
default:
|
|
|
|
if(xml == "" && ss == "") { cell.t = 'z'; }
|
|
|
|
else { cell.t = 's'; cell.v = xlml_fixstr(ss||xml); }
|
|
|
|
break;
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
|
|
|
safe_format_xlml(cell, nf, o);
|
2017-04-26 02:27:12 +00:00
|
|
|
if(o.cellFormula !== false) {
|
2017-02-19 20:36:32 +00:00
|
|
|
if(cell.Formula) {
|
|
|
|
var fstr = unescapexml(cell.Formula);
|
|
|
|
/* strictly speaking, the leading = is required but some writers omit */
|
2018-01-11 08:01:25 +00:00
|
|
|
if(fstr.charCodeAt(0) == 61 /* = */) fstr = fstr.slice(1);
|
2017-02-19 20:36:32 +00:00
|
|
|
cell.f = rc_to_a1(fstr, base);
|
2017-04-02 06:47:25 +00:00
|
|
|
delete cell.Formula;
|
2017-02-19 20:36:32 +00:00
|
|
|
if(cell.ArrayRange == "RC") cell.F = rc_to_a1("RC:RC", base);
|
|
|
|
else if(cell.ArrayRange) {
|
|
|
|
cell.F = rc_to_a1(cell.ArrayRange, base);
|
|
|
|
arrayf.push([safe_decode_range(cell.F), cell.F]);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for(i = 0; i < arrayf.length; ++i)
|
|
|
|
if(base.r >= arrayf[i][0].s.r && base.r <= arrayf[i][0].e.r)
|
|
|
|
if(base.c >= arrayf[i][0].s.c && base.c <= arrayf[i][0].e.c)
|
|
|
|
cell.F = arrayf[i][1];
|
|
|
|
}
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
|
|
|
if(o.cellStyles) {
|
|
|
|
interiors.forEach(function(x) {
|
|
|
|
if(!S.patternType && x.patternType) S.patternType = x.patternType;
|
|
|
|
});
|
|
|
|
cell.s = S;
|
|
|
|
}
|
2017-11-15 18:14:02 +00:00
|
|
|
if(cell.StyleID !== undefined) cell.ixfe = cell.StyleID;
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
|
|
|
|
2017-02-10 19:23:01 +00:00
|
|
|
function xlml_clean_comment(comment/*:any*/) {
|
2017-04-02 06:47:25 +00:00
|
|
|
comment.t = comment.v || "";
|
|
|
|
comment.t = comment.t.replace(/\r\n/g,"\n").replace(/\r/g,"\n");
|
2015-04-02 20:32:22 +00:00
|
|
|
comment.v = comment.w = comment.ixfe = undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* TODO: Everything */
|
2017-06-24 06:51:37 +00:00
|
|
|
function parse_xlml_xml(d, _opts)/*:Workbook*/ {
|
|
|
|
var opts = _opts || {};
|
2017-03-25 01:36:40 +00:00
|
|
|
make_ssf(SSF);
|
2017-02-24 10:33:01 +00:00
|
|
|
var str = debom(xlml_normalize(d));
|
2017-12-30 05:40:35 +00:00
|
|
|
if(opts.type == 'binary' || opts.type == 'array' || opts.type == 'base64') {
|
2022-03-11 05:29:05 +00:00
|
|
|
if(typeof $cptable !== 'undefined') str = $cptable.utils.decode(65001, char_codes(str));
|
2017-09-30 06:18:11 +00:00
|
|
|
else str = utf8read(str);
|
|
|
|
}
|
2017-07-26 08:35:28 +00:00
|
|
|
var opening = str.slice(0, 1024).toLowerCase(), ishtml = false;
|
2021-12-04 23:27:36 +00:00
|
|
|
opening = opening.replace(/".*?"/g, "");
|
2021-09-30 07:28:03 +00:00
|
|
|
if((opening.indexOf(">") & 1023) > Math.min((opening.indexOf(",") & 1023), (opening.indexOf(";")&1023))) { var _o = dup(opts); _o.type = "string"; return PRN.to_workbook(str, _o); }
|
2017-07-26 08:35:28 +00:00
|
|
|
if(opening.indexOf("<?xml") == -1) ["html", "table", "head", "meta", "script", "style", "div"].forEach(function(tag) { if(opening.indexOf("<" + tag) >= 0) ishtml = true; });
|
|
|
|
if(ishtml) return HTML_.to_workbook(str, opts);
|
2015-04-02 20:32:22 +00:00
|
|
|
var Rn;
|
|
|
|
var state = [], tmp;
|
2017-04-09 04:03:19 +00:00
|
|
|
if(DENSE != null && opts.dense == null) opts.dense = DENSE;
|
2017-12-30 05:40:35 +00:00
|
|
|
var sheets = {}, sheetnames/*:Array<string>*/ = [], cursheet/*:Worksheet*/ = (opts.dense ? [] : {}), sheetname = "";
|
2022-03-16 03:18:09 +00:00
|
|
|
var cell = ({}/*:any*/), row = {};// eslint-disable-line no-unused-vars
|
2017-02-10 19:23:01 +00:00
|
|
|
var dtag = xlml_parsexmltag('<Data ss:Type="String">'), didx = 0;
|
2015-04-02 20:32:22 +00:00
|
|
|
var c = 0, r = 0;
|
2017-12-30 05:40:35 +00:00
|
|
|
var refguess/*:Range*/ = {s: {r:2000000, c:2000000}, e: {r:0, c:0} };
|
2015-04-02 20:32:22 +00:00
|
|
|
var styles = {}, stag = {};
|
|
|
|
var ss = "", fidx = 0;
|
2017-12-30 05:40:35 +00:00
|
|
|
var merges/*:Array<Range>*/ = [];
|
|
|
|
var Props = {}, Custprops = {}, pidx = 0, cp = [];
|
|
|
|
var comments/*:Array<Comment>*/ = [], comment/*:Comment*/ = ({}/*:any*/);
|
2017-03-20 09:02:25 +00:00
|
|
|
var cstys = [], csty, seencol = false;
|
2017-12-30 05:40:35 +00:00
|
|
|
var arrayf/*:Array<[Range, string]>*/ = [];
|
|
|
|
var rowinfo/*:Array<RowInfo>*/ = [], rowobj = {}, cc = 0, rr = 0;
|
2017-06-01 21:22:11 +00:00
|
|
|
var Workbook/*:WBWBProps*/ = ({ Sheets:[], WBProps:{date1904:false} }/*:any*/), wsprops = {};
|
2015-04-02 20:32:22 +00:00
|
|
|
xlmlregex.lastIndex = 0;
|
2017-06-24 06:51:37 +00:00
|
|
|
str = str.replace(/<!--([\s\S]*?)-->/mg,"");
|
2020-03-18 06:47:02 +00:00
|
|
|
var raw_Rn3 = "";
|
|
|
|
while((Rn = xlmlregex.exec(str))) switch((Rn[3] = (raw_Rn3 = Rn[3]).toLowerCase())) {
|
|
|
|
case 'data' /*case 'Data'*/:
|
|
|
|
if(raw_Rn3 == "data") {
|
|
|
|
if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));}
|
|
|
|
else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]);
|
|
|
|
break;
|
|
|
|
}
|
2015-04-02 20:32:22 +00:00
|
|
|
if(state[state.length-1][1]) break;
|
2020-03-18 06:47:02 +00:00
|
|
|
if(Rn[1]==='/') parse_xlml_data(str.slice(didx, Rn.index), ss, dtag, state[state.length-1][0]==/*"Comment"*/"comment"?comment:cell, {c:c,r:r}, styles, cstys[c], row, arrayf, opts);
|
2015-04-02 20:32:22 +00:00
|
|
|
else { ss = ""; dtag = xlml_parsexmltag(Rn[0]); didx = Rn.index + Rn[0].length; }
|
|
|
|
break;
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'cell' /*case 'Cell'*/:
|
2015-04-02 20:32:22 +00:00
|
|
|
if(Rn[1]==='/'){
|
|
|
|
if(comments.length > 0) cell.c = comments;
|
2017-04-08 06:55:35 +00:00
|
|
|
if((!opts.sheetRows || opts.sheetRows > r) && cell.v !== undefined) {
|
|
|
|
if(opts.dense) {
|
|
|
|
if(!cursheet[r]) cursheet[r] = [];
|
|
|
|
cursheet[r][c] = cell;
|
|
|
|
} else cursheet[encode_col(c) + encode_row(r)] = cell;
|
|
|
|
}
|
2015-04-02 20:32:22 +00:00
|
|
|
if(cell.HRef) {
|
2021-09-30 07:28:03 +00:00
|
|
|
cell.l = ({Target:unescapexml(cell.HRef)}/*:any*/);
|
2017-12-15 01:18:40 +00:00
|
|
|
if(cell.HRefScreenTip) cell.l.Tooltip = cell.HRefScreenTip;
|
2017-03-28 22:03:03 +00:00
|
|
|
delete cell.HRef; delete cell.HRefScreenTip;
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
|
|
|
if(cell.MergeAcross || cell.MergeDown) {
|
2017-10-17 00:14:32 +00:00
|
|
|
cc = c + (parseInt(cell.MergeAcross,10)|0);
|
|
|
|
rr = r + (parseInt(cell.MergeDown,10)|0);
|
2017-12-30 05:40:35 +00:00
|
|
|
merges.push({s:{c:c,r:r},e:{c:cc,r:rr}});
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
2017-03-15 08:19:02 +00:00
|
|
|
if(!opts.sheetStubs) { if(cell.MergeAcross) c = cc + 1; else ++c; }
|
|
|
|
else if(cell.MergeAcross || cell.MergeDown) {
|
|
|
|
/*:: if(!cc) cc = 0; if(!rr) rr = 0; */
|
|
|
|
for(var cma = c; cma <= cc; ++cma) {
|
|
|
|
for(var cmd = r; cmd <= rr; ++cmd) {
|
2017-04-08 06:55:35 +00:00
|
|
|
if(cma > c || cmd > r) {
|
|
|
|
if(opts.dense) {
|
|
|
|
if(!cursheet[cmd]) cursheet[cmd] = [];
|
|
|
|
cursheet[cmd][cma] = {t:'z'};
|
|
|
|
} else cursheet[encode_col(cma) + encode_row(cmd)] = {t:'z'};
|
|
|
|
}
|
2017-03-15 08:19:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
c = cc + 1;
|
|
|
|
}
|
|
|
|
else ++c;
|
2015-04-02 20:32:22 +00:00
|
|
|
} else {
|
|
|
|
cell = xlml_parsexmltagobj(Rn[0]);
|
|
|
|
if(cell.Index) c = +cell.Index - 1;
|
|
|
|
if(c < refguess.s.c) refguess.s.c = c;
|
|
|
|
if(c > refguess.e.c) refguess.e.c = c;
|
2017-02-22 06:57:59 +00:00
|
|
|
if(Rn[0].slice(-2) === "/>") ++c;
|
2015-04-02 20:32:22 +00:00
|
|
|
comments = [];
|
|
|
|
}
|
|
|
|
break;
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'row' /*case 'Row'*/:
|
2017-02-22 06:57:59 +00:00
|
|
|
if(Rn[1]==='/' || Rn[0].slice(-2) === "/>") {
|
2015-04-02 20:32:22 +00:00
|
|
|
if(r < refguess.s.r) refguess.s.r = r;
|
|
|
|
if(r > refguess.e.r) refguess.e.r = r;
|
2017-02-22 06:57:59 +00:00
|
|
|
if(Rn[0].slice(-2) === "/>") {
|
2015-04-02 20:32:22 +00:00
|
|
|
row = xlml_parsexmltag(Rn[0]);
|
|
|
|
if(row.Index) r = +row.Index - 1;
|
|
|
|
}
|
|
|
|
c = 0; ++r;
|
|
|
|
} else {
|
|
|
|
row = xlml_parsexmltag(Rn[0]);
|
|
|
|
if(row.Index) r = +row.Index - 1;
|
2017-04-28 07:28:03 +00:00
|
|
|
rowobj = {};
|
2017-06-10 01:47:42 +00:00
|
|
|
if(row.AutoFitHeight == "0" || row.Height) {
|
2017-04-28 07:28:03 +00:00
|
|
|
rowobj.hpx = parseInt(row.Height, 10); rowobj.hpt = px2pt(rowobj.hpx);
|
|
|
|
rowinfo[r] = rowobj;
|
|
|
|
}
|
|
|
|
if(row.Hidden == "1") { rowobj.hidden = true; rowinfo[r] = rowobj; }
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
|
|
|
break;
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'worksheet' /*case 'Worksheet'*/: /* TODO: read range from FullRows/FullColumns */
|
2015-04-02 20:32:22 +00:00
|
|
|
if(Rn[1]==='/'){
|
2017-03-12 18:02:43 +00:00
|
|
|
if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));
|
2015-04-02 20:32:22 +00:00
|
|
|
sheetnames.push(sheetname);
|
2018-04-06 06:39:48 +00:00
|
|
|
if(refguess.s.r <= refguess.e.r && refguess.s.c <= refguess.e.c) {
|
|
|
|
cursheet["!ref"] = encode_range(refguess);
|
|
|
|
if(opts.sheetRows && opts.sheetRows <= refguess.e.r) {
|
|
|
|
cursheet["!fullref"] = cursheet["!ref"];
|
|
|
|
refguess.e.r = opts.sheetRows - 1;
|
|
|
|
cursheet["!ref"] = encode_range(refguess);
|
|
|
|
}
|
|
|
|
}
|
2017-12-30 05:40:35 +00:00
|
|
|
if(merges.length) cursheet["!merges"] = merges;
|
2017-03-20 09:02:25 +00:00
|
|
|
if(cstys.length > 0) cursheet["!cols"] = cstys;
|
|
|
|
if(rowinfo.length > 0) cursheet["!rows"] = rowinfo;
|
2015-04-02 20:32:22 +00:00
|
|
|
sheets[sheetname] = cursheet;
|
|
|
|
} else {
|
2017-02-03 20:50:45 +00:00
|
|
|
refguess = {s: {r:2000000, c:2000000}, e: {r:0, c:0} };
|
2015-04-02 20:32:22 +00:00
|
|
|
r = c = 0;
|
|
|
|
state.push([Rn[3], false]);
|
|
|
|
tmp = xlml_parsexmltag(Rn[0]);
|
2017-03-13 06:46:37 +00:00
|
|
|
sheetname = unescapexml(tmp.Name);
|
2017-04-08 06:55:35 +00:00
|
|
|
cursheet = (opts.dense ? [] : {});
|
2017-12-30 05:40:35 +00:00
|
|
|
merges = [];
|
2017-03-18 00:45:06 +00:00
|
|
|
arrayf = [];
|
2017-03-20 09:02:25 +00:00
|
|
|
rowinfo = [];
|
2017-03-31 18:46:42 +00:00
|
|
|
wsprops = {name:sheetname, Hidden:0};
|
|
|
|
Workbook.Sheets.push(wsprops);
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
|
|
|
break;
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'table' /*case 'Table'*/:
|
2017-03-12 18:02:43 +00:00
|
|
|
if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));}
|
2015-04-02 20:32:22 +00:00
|
|
|
else if(Rn[0].slice(-2) == "/>") break;
|
|
|
|
else {
|
|
|
|
state.push([Rn[3], false]);
|
2017-03-20 09:02:25 +00:00
|
|
|
cstys = []; seencol = false;
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'style' /*case 'Style'*/:
|
2015-04-02 20:32:22 +00:00
|
|
|
if(Rn[1]==='/') process_style_xlml(styles, stag, opts);
|
|
|
|
else stag = xlml_parsexmltag(Rn[0]);
|
|
|
|
break;
|
|
|
|
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'numberformat' /*case 'NumberFormat'*/:
|
2017-03-25 01:36:40 +00:00
|
|
|
stag.nf = unescapexml(xlml_parsexmltag(Rn[0]).Format || "General");
|
|
|
|
if(XLMLFormatMap[stag.nf]) stag.nf = XLMLFormatMap[stag.nf];
|
|
|
|
for(var ssfidx = 0; ssfidx != 0x188; ++ssfidx) if(SSF._table[ssfidx] == stag.nf) break;
|
|
|
|
if(ssfidx == 0x188) for(ssfidx = 0x39; ssfidx != 0x188; ++ssfidx) if(SSF._table[ssfidx] == null) { SSF.load(stag.nf, ssfidx); break; }
|
2015-04-02 20:32:22 +00:00
|
|
|
break;
|
|
|
|
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'column' /*case 'Column'*/:
|
|
|
|
if(state[state.length-1][0] !== /*'Table'*/'table') break;
|
2015-04-02 20:32:22 +00:00
|
|
|
csty = xlml_parsexmltag(Rn[0]);
|
2017-04-28 07:28:03 +00:00
|
|
|
if(csty.Hidden) { csty.hidden = true; delete csty.Hidden; }
|
|
|
|
if(csty.Width) csty.wpx = parseInt(csty.Width, 10);
|
2017-03-20 09:02:25 +00:00
|
|
|
if(!seencol && csty.wpx > 10) {
|
2017-04-28 07:28:03 +00:00
|
|
|
seencol = true; MDW = DEF_MDW; //find_mdw_wpx(csty.wpx);
|
2017-03-20 09:02:25 +00:00
|
|
|
for(var _col = 0; _col < cstys.length; ++_col) if(cstys[_col]) process_col(cstys[_col]);
|
|
|
|
}
|
|
|
|
if(seencol) process_col(csty);
|
2015-04-02 20:32:22 +00:00
|
|
|
cstys[(csty.Index-1||cstys.length)] = csty;
|
2017-03-20 09:02:25 +00:00
|
|
|
for(var i = 0; i < +csty.Span; ++i) cstys[cstys.length] = dup(csty);
|
2015-04-02 20:32:22 +00:00
|
|
|
break;
|
|
|
|
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'namedrange' /*case 'NamedRange'*/:
|
|
|
|
if(Rn[1]==='/') break;
|
2017-04-11 22:15:36 +00:00
|
|
|
if(!Workbook.Names) Workbook.Names = [];
|
|
|
|
var _NamedRange = parsexmltag(Rn[0]);
|
2017-05-13 18:21:22 +00:00
|
|
|
var _DefinedName/*:DefinedName*/ = ({
|
2017-04-11 22:15:36 +00:00
|
|
|
Name: _NamedRange.Name,
|
2018-01-11 08:01:25 +00:00
|
|
|
Ref: rc_to_a1(_NamedRange.RefersTo.slice(1), {r:0, c:0})
|
2017-05-13 18:21:22 +00:00
|
|
|
}/*:any*/);
|
2017-04-11 22:15:36 +00:00
|
|
|
if(Workbook.Sheets.length>0) _DefinedName.Sheet=Workbook.Sheets.length-1;
|
2017-05-13 18:21:22 +00:00
|
|
|
/*:: if(Workbook.Names) */Workbook.Names.push(_DefinedName);
|
2017-04-11 22:15:36 +00:00
|
|
|
break;
|
|
|
|
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'namedcell' /*case 'NamedCell'*/: break;
|
|
|
|
case 'b' /*case 'B'*/: break;
|
|
|
|
case 'i' /*case 'I'*/: break;
|
|
|
|
case 'u' /*case 'U'*/: break;
|
|
|
|
case 's' /*case 'S'*/: break;
|
|
|
|
case 'em' /*case 'EM'*/: break;
|
|
|
|
case 'h2' /*case 'H2'*/: break;
|
|
|
|
case 'h3' /*case 'H3'*/: break;
|
|
|
|
case 'sub' /*case 'Sub'*/: break;
|
|
|
|
case 'sup' /*case 'Sup'*/: break;
|
|
|
|
case 'span' /*case 'Span'*/: break;
|
|
|
|
case 'alignment' /*case 'Alignment'*/:
|
2019-11-01 03:09:14 +00:00
|
|
|
break;
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'borders' /*case 'Borders'*/: break;
|
|
|
|
case 'border' /*case 'Border'*/: break;
|
|
|
|
case 'font' /*case 'Font'*/:
|
2017-02-22 06:57:59 +00:00
|
|
|
if(Rn[0].slice(-2) === "/>") break;
|
2015-04-02 20:32:22 +00:00
|
|
|
else if(Rn[1]==="/") ss += str.slice(fidx, Rn.index);
|
|
|
|
else fidx = Rn.index + Rn[0].length;
|
|
|
|
break;
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'interior' /*case 'Interior'*/:
|
2015-04-02 20:32:22 +00:00
|
|
|
if(!opts.cellStyles) break;
|
|
|
|
stag.Interior = xlml_parsexmltag(Rn[0]);
|
|
|
|
break;
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'protection' /*case 'Protection'*/: break;
|
|
|
|
|
|
|
|
case 'author' /*case 'Author'*/:
|
|
|
|
case 'title' /*case 'Title'*/:
|
|
|
|
case 'description' /*case 'Description'*/:
|
|
|
|
case 'created' /*case 'Created'*/:
|
|
|
|
case 'keywords' /*case 'Keywords'*/:
|
|
|
|
case 'subject' /*case 'Subject'*/:
|
|
|
|
case 'category' /*case 'Category'*/:
|
|
|
|
case 'company' /*case 'Company'*/:
|
|
|
|
case 'lastauthor' /*case 'LastAuthor'*/:
|
|
|
|
case 'lastsaved' /*case 'LastSaved'*/:
|
|
|
|
case 'lastprinted' /*case 'LastPrinted'*/:
|
|
|
|
case 'version' /*case 'Version'*/:
|
|
|
|
case 'revision' /*case 'Revision'*/:
|
|
|
|
case 'totaltime' /*case 'TotalTime'*/:
|
|
|
|
case 'hyperlinkbase' /*case 'HyperlinkBase'*/:
|
|
|
|
case 'manager' /*case 'Manager'*/:
|
|
|
|
case 'contentstatus' /*case 'ContentStatus'*/:
|
|
|
|
case 'identifier' /*case 'Identifier'*/:
|
|
|
|
case 'language' /*case 'Language'*/:
|
|
|
|
case 'appname' /*case 'AppName'*/:
|
2017-02-22 06:57:59 +00:00
|
|
|
if(Rn[0].slice(-2) === "/>") break;
|
2020-03-18 06:47:02 +00:00
|
|
|
else if(Rn[1]==="/") xlml_set_prop(Props, raw_Rn3, str.slice(pidx, Rn.index));
|
2015-04-02 20:32:22 +00:00
|
|
|
else pidx = Rn.index + Rn[0].length;
|
|
|
|
break;
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'paragraphs' /*case 'Paragraphs'*/: break;
|
2015-04-02 20:32:22 +00:00
|
|
|
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'styles' /*case 'Styles'*/:
|
|
|
|
case 'workbook' /*case 'Workbook'*/:
|
2017-03-12 18:02:43 +00:00
|
|
|
if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));}
|
2015-04-02 20:32:22 +00:00
|
|
|
else state.push([Rn[3], false]);
|
|
|
|
break;
|
|
|
|
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'comment' /*case 'Comment'*/:
|
2015-04-02 20:32:22 +00:00
|
|
|
if(Rn[1]==='/'){
|
2017-03-12 18:02:43 +00:00
|
|
|
if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));
|
2015-04-02 20:32:22 +00:00
|
|
|
xlml_clean_comment(comment);
|
|
|
|
comments.push(comment);
|
|
|
|
} else {
|
|
|
|
state.push([Rn[3], false]);
|
|
|
|
tmp = xlml_parsexmltag(Rn[0]);
|
2017-12-30 05:40:35 +00:00
|
|
|
comment = ({a:tmp.Author}/*:any*/);
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'autofilter' /*case 'AutoFilter'*/:
|
2017-04-10 05:10:54 +00:00
|
|
|
if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));}
|
|
|
|
else if(Rn[0].charAt(Rn[0].length-2) !== '/') {
|
|
|
|
var AutoFilter = xlml_parsexmltag(Rn[0]);
|
|
|
|
cursheet['!autofilter'] = { ref:rc_to_a1(AutoFilter.Range).replace(/\$/g,"") };
|
|
|
|
state.push([Rn[3], true]);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'name' /*case 'Name'*/: break;
|
2015-04-02 20:32:22 +00:00
|
|
|
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'datavalidation' /*case 'DataValidation'*/:
|
2019-11-01 03:09:14 +00:00
|
|
|
if(Rn[1]==='/'){
|
|
|
|
if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));
|
|
|
|
} else {
|
|
|
|
if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'pixelsperinch' /*case 'PixelsPerInch'*/:
|
|
|
|
break;
|
|
|
|
case 'componentoptions' /*case 'ComponentOptions'*/:
|
|
|
|
case 'documentproperties' /*case 'DocumentProperties'*/:
|
|
|
|
case 'customdocumentproperties' /*case 'CustomDocumentProperties'*/:
|
|
|
|
case 'officedocumentsettings' /*case 'OfficeDocumentSettings'*/:
|
|
|
|
case 'pivottable' /*case 'PivotTable'*/:
|
|
|
|
case 'pivotcache' /*case 'PivotCache'*/:
|
|
|
|
case 'names' /*case 'Names'*/:
|
|
|
|
case 'mapinfo' /*case 'MapInfo'*/:
|
|
|
|
case 'pagebreaks' /*case 'PageBreaks'*/:
|
|
|
|
case 'querytable' /*case 'QueryTable'*/:
|
|
|
|
case 'sorting' /*case 'Sorting'*/:
|
|
|
|
case 'schema' /*case 'Schema'*/: //case 'data' /*case 'data'*/:
|
|
|
|
case 'conditionalformatting' /*case 'ConditionalFormatting'*/:
|
|
|
|
case 'smarttagtype' /*case 'SmartTagType'*/:
|
|
|
|
case 'smarttags' /*case 'SmartTags'*/:
|
|
|
|
case 'excelworkbook' /*case 'ExcelWorkbook'*/:
|
|
|
|
case 'workbookoptions' /*case 'WorkbookOptions'*/:
|
|
|
|
case 'worksheetoptions' /*case 'WorksheetOptions'*/:
|
2017-03-12 18:02:43 +00:00
|
|
|
if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));}
|
2015-04-02 20:32:22 +00:00
|
|
|
else if(Rn[0].charAt(Rn[0].length-2) !== '/') state.push([Rn[3], true]);
|
|
|
|
break;
|
|
|
|
|
2021-11-08 04:52:18 +00:00
|
|
|
case 'null' /*case 'Null'*/: break;
|
|
|
|
|
2015-04-02 20:32:22 +00:00
|
|
|
default:
|
2017-02-22 06:57:59 +00:00
|
|
|
/* FODS file root is <office:document> */
|
|
|
|
if(state.length == 0 && Rn[3] == "document") return parse_fods(str, opts);
|
|
|
|
/* UOS file root is <uof:UOF> */
|
2020-03-18 06:47:02 +00:00
|
|
|
if(state.length == 0 && Rn[3] == "uof"/*"UOF"*/) return parse_fods(str, opts);
|
2017-02-22 06:57:59 +00:00
|
|
|
|
2015-04-02 20:32:22 +00:00
|
|
|
var seen = true;
|
|
|
|
switch(state[state.length-1][0]) {
|
|
|
|
/* OfficeDocumentSettings */
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'officedocumentsettings' /*case 'OfficeDocumentSettings'*/: switch(Rn[3]) {
|
|
|
|
case 'allowpng' /*case 'AllowPNG'*/: break;
|
|
|
|
case 'removepersonalinformation' /*case 'RemovePersonalInformation'*/: break;
|
|
|
|
case 'downloadcomponents' /*case 'DownloadComponents'*/: break;
|
|
|
|
case 'locationofcomponents' /*case 'LocationOfComponents'*/: break;
|
|
|
|
case 'colors' /*case 'Colors'*/: break;
|
|
|
|
case 'color' /*case 'Color'*/: break;
|
|
|
|
case 'index' /*case 'Index'*/: break;
|
|
|
|
case 'rgb' /*case 'RGB'*/: break;
|
|
|
|
case 'targetscreensize' /*case 'TargetScreenSize'*/: break;
|
|
|
|
case 'readonlyrecommended' /*case 'ReadOnlyRecommended'*/: break;
|
2015-04-02 20:32:22 +00:00
|
|
|
default: seen = false;
|
|
|
|
} break;
|
|
|
|
|
|
|
|
/* ComponentOptions */
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'componentoptions' /*case 'ComponentOptions'*/: switch(Rn[3]) {
|
|
|
|
case 'toolbar' /*case 'Toolbar'*/: break;
|
|
|
|
case 'hideofficelogo' /*case 'HideOfficeLogo'*/: break;
|
|
|
|
case 'spreadsheetautofit' /*case 'SpreadsheetAutoFit'*/: break;
|
|
|
|
case 'label' /*case 'Label'*/: break;
|
|
|
|
case 'caption' /*case 'Caption'*/: break;
|
|
|
|
case 'maxheight' /*case 'MaxHeight'*/: break;
|
|
|
|
case 'maxwidth' /*case 'MaxWidth'*/: break;
|
|
|
|
case 'nextsheetnumber' /*case 'NextSheetNumber'*/: break;
|
2015-04-02 20:32:22 +00:00
|
|
|
default: seen = false;
|
|
|
|
} break;
|
|
|
|
|
|
|
|
/* ExcelWorkbook */
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'excelworkbook' /*case 'ExcelWorkbook'*/: switch(Rn[3]) {
|
|
|
|
case 'date1904' /*case 'Date1904'*/:
|
2017-06-01 21:22:11 +00:00
|
|
|
/*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */
|
|
|
|
Workbook.WBProps.date1904 = true;
|
|
|
|
break;
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'windowheight' /*case 'WindowHeight'*/: break;
|
|
|
|
case 'windowwidth' /*case 'WindowWidth'*/: break;
|
|
|
|
case 'windowtopx' /*case 'WindowTopX'*/: break;
|
|
|
|
case 'windowtopy' /*case 'WindowTopY'*/: break;
|
|
|
|
case 'tabratio' /*case 'TabRatio'*/: break;
|
|
|
|
case 'protectstructure' /*case 'ProtectStructure'*/: break;
|
|
|
|
case 'protectwindow' /*case 'ProtectWindow'*/: break;
|
|
|
|
case 'protectwindows' /*case 'ProtectWindows'*/: break;
|
|
|
|
case 'activesheet' /*case 'ActiveSheet'*/: break;
|
|
|
|
case 'displayinknotes' /*case 'DisplayInkNotes'*/: break;
|
|
|
|
case 'firstvisiblesheet' /*case 'FirstVisibleSheet'*/: break;
|
|
|
|
case 'supbook' /*case 'SupBook'*/: break;
|
|
|
|
case 'sheetname' /*case 'SheetName'*/: break;
|
|
|
|
case 'sheetindex' /*case 'SheetIndex'*/: break;
|
|
|
|
case 'sheetindexfirst' /*case 'SheetIndexFirst'*/: break;
|
|
|
|
case 'sheetindexlast' /*case 'SheetIndexLast'*/: break;
|
|
|
|
case 'dll' /*case 'Dll'*/: break;
|
|
|
|
case 'acceptlabelsinformulas' /*case 'AcceptLabelsInFormulas'*/: break;
|
|
|
|
case 'donotsavelinkvalues' /*case 'DoNotSaveLinkValues'*/: break;
|
|
|
|
case 'iteration' /*case 'Iteration'*/: break;
|
|
|
|
case 'maxiterations' /*case 'MaxIterations'*/: break;
|
|
|
|
case 'maxchange' /*case 'MaxChange'*/: break;
|
|
|
|
case 'path' /*case 'Path'*/: break;
|
|
|
|
case 'xct' /*case 'Xct'*/: break;
|
|
|
|
case 'count' /*case 'Count'*/: break;
|
|
|
|
case 'selectedsheets' /*case 'SelectedSheets'*/: break;
|
|
|
|
case 'calculation' /*case 'Calculation'*/: break;
|
|
|
|
case 'uncalced' /*case 'Uncalced'*/: break;
|
|
|
|
case 'startupprompt' /*case 'StartupPrompt'*/: break;
|
|
|
|
case 'crn' /*case 'Crn'*/: break;
|
|
|
|
case 'externname' /*case 'ExternName'*/: break;
|
|
|
|
case 'formula' /*case 'Formula'*/: break;
|
|
|
|
case 'colfirst' /*case 'ColFirst'*/: break;
|
|
|
|
case 'collast' /*case 'ColLast'*/: break;
|
|
|
|
case 'wantadvise' /*case 'WantAdvise'*/: break;
|
|
|
|
case 'boolean' /*case 'Boolean'*/: break;
|
|
|
|
case 'error' /*case 'Error'*/: break;
|
|
|
|
case 'text' /*case 'Text'*/: break;
|
|
|
|
case 'ole' /*case 'OLE'*/: break;
|
|
|
|
case 'noautorecover' /*case 'NoAutoRecover'*/: break;
|
|
|
|
case 'publishobjects' /*case 'PublishObjects'*/: break;
|
|
|
|
case 'donotcalculatebeforesave' /*case 'DoNotCalculateBeforeSave'*/: break;
|
|
|
|
case 'number' /*case 'Number'*/: break;
|
|
|
|
case 'refmoder1c1' /*case 'RefModeR1C1'*/: break;
|
|
|
|
case 'embedsavesmarttags' /*case 'EmbedSaveSmartTags'*/: break;
|
2015-04-02 20:32:22 +00:00
|
|
|
default: seen = false;
|
|
|
|
} break;
|
|
|
|
|
|
|
|
/* WorkbookOptions */
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'workbookoptions' /*case 'WorkbookOptions'*/: switch(Rn[3]) {
|
|
|
|
case 'owcversion' /*case 'OWCVersion'*/: break;
|
|
|
|
case 'height' /*case 'Height'*/: break;
|
|
|
|
case 'width' /*case 'Width'*/: break;
|
2015-04-02 20:32:22 +00:00
|
|
|
default: seen = false;
|
|
|
|
} break;
|
|
|
|
|
|
|
|
/* WorksheetOptions */
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'worksheetoptions' /*case 'WorksheetOptions'*/: switch(Rn[3]) {
|
|
|
|
case 'visible' /*case 'Visible'*/:
|
2017-05-09 18:07:57 +00:00
|
|
|
if(Rn[0].slice(-2) === "/>"){/* empty */}
|
2017-03-31 18:46:42 +00:00
|
|
|
else if(Rn[1]==="/") switch(str.slice(pidx, Rn.index)) {
|
|
|
|
case "SheetHidden": wsprops.Hidden = 1; break;
|
|
|
|
case "SheetVeryHidden": wsprops.Hidden = 2; break;
|
|
|
|
}
|
|
|
|
else pidx = Rn.index + Rn[0].length;
|
|
|
|
break;
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'header' /*case 'Header'*/:
|
2017-04-13 01:29:38 +00:00
|
|
|
if(!cursheet['!margins']) default_margins(cursheet['!margins']={}, 'xlml');
|
2022-02-13 09:35:34 +00:00
|
|
|
if(!isNaN(+parsexmltag(Rn[0]).Margin)) cursheet['!margins'].header = +parsexmltag(Rn[0]).Margin;
|
2017-04-13 01:29:38 +00:00
|
|
|
break;
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'footer' /*case 'Footer'*/:
|
2017-04-13 01:29:38 +00:00
|
|
|
if(!cursheet['!margins']) default_margins(cursheet['!margins']={}, 'xlml');
|
2022-02-13 09:35:34 +00:00
|
|
|
if(!isNaN(+parsexmltag(Rn[0]).Margin)) cursheet['!margins'].footer = +parsexmltag(Rn[0]).Margin;
|
2017-04-13 01:29:38 +00:00
|
|
|
break;
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'pagemargins' /*case 'PageMargins'*/:
|
2017-04-13 01:29:38 +00:00
|
|
|
var pagemargins = parsexmltag(Rn[0]);
|
|
|
|
if(!cursheet['!margins']) default_margins(cursheet['!margins']={},'xlml');
|
2022-02-13 09:35:34 +00:00
|
|
|
if(!isNaN(+pagemargins.Top)) cursheet['!margins'].top = +pagemargins.Top;
|
|
|
|
if(!isNaN(+pagemargins.Left)) cursheet['!margins'].left = +pagemargins.Left;
|
|
|
|
if(!isNaN(+pagemargins.Right)) cursheet['!margins'].right = +pagemargins.Right;
|
|
|
|
if(!isNaN(+pagemargins.Bottom)) cursheet['!margins'].bottom = +pagemargins.Bottom;
|
2017-04-13 01:29:38 +00:00
|
|
|
break;
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'displayrighttoleft' /*case 'DisplayRightToLeft'*/:
|
2017-12-30 05:40:35 +00:00
|
|
|
if(!Workbook.Views) Workbook.Views = [];
|
|
|
|
if(!Workbook.Views[0]) Workbook.Views[0] = {};
|
|
|
|
Workbook.Views[0].RTL = true;
|
|
|
|
break;
|
|
|
|
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'freezepanes' /*case 'FreezePanes'*/: break;
|
|
|
|
case 'frozennosplit' /*case 'FrozenNoSplit'*/: break;
|
2019-11-01 03:09:14 +00:00
|
|
|
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'splithorizontal' /*case 'SplitHorizontal'*/:
|
|
|
|
case 'splitvertical' /*case 'SplitVertical'*/:
|
2019-11-01 03:09:14 +00:00
|
|
|
break;
|
|
|
|
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'donotdisplaygridlines' /*case 'DoNotDisplayGridlines'*/:
|
2019-11-01 03:09:14 +00:00
|
|
|
break;
|
|
|
|
|
2020-09-11 08:38:33 +00:00
|
|
|
case 'activerow' /*case 'ActiveRow'*/: break;
|
|
|
|
case 'activecol' /*case 'ActiveCol'*/: break;
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'toprowbottompane' /*case 'TopRowBottomPane'*/: break;
|
|
|
|
case 'leftcolumnrightpane' /*case 'LeftColumnRightPane'*/: break;
|
|
|
|
|
|
|
|
case 'unsynced' /*case 'Unsynced'*/: break;
|
|
|
|
case 'print' /*case 'Print'*/: break;
|
2021-09-22 06:45:08 +00:00
|
|
|
case 'printerrors' /*case 'PrintErrors'*/: break;
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'panes' /*case 'Panes'*/: break;
|
|
|
|
case 'scale' /*case 'Scale'*/: break;
|
|
|
|
case 'pane' /*case 'Pane'*/: break;
|
|
|
|
case 'number' /*case 'Number'*/: break;
|
|
|
|
case 'layout' /*case 'Layout'*/: break;
|
|
|
|
case 'pagesetup' /*case 'PageSetup'*/: break;
|
|
|
|
case 'selected' /*case 'Selected'*/: break;
|
|
|
|
case 'protectobjects' /*case 'ProtectObjects'*/: break;
|
|
|
|
case 'enableselection' /*case 'EnableSelection'*/: break;
|
|
|
|
case 'protectscenarios' /*case 'ProtectScenarios'*/: break;
|
|
|
|
case 'validprinterinfo' /*case 'ValidPrinterInfo'*/: break;
|
|
|
|
case 'horizontalresolution' /*case 'HorizontalResolution'*/: break;
|
|
|
|
case 'verticalresolution' /*case 'VerticalResolution'*/: break;
|
|
|
|
case 'numberofcopies' /*case 'NumberofCopies'*/: break;
|
|
|
|
case 'activepane' /*case 'ActivePane'*/: break;
|
|
|
|
case 'toprowvisible' /*case 'TopRowVisible'*/: break;
|
|
|
|
case 'leftcolumnvisible' /*case 'LeftColumnVisible'*/: break;
|
|
|
|
case 'fittopage' /*case 'FitToPage'*/: break;
|
|
|
|
case 'rangeselection' /*case 'RangeSelection'*/: break;
|
|
|
|
case 'papersizeindex' /*case 'PaperSizeIndex'*/: break;
|
|
|
|
case 'pagelayoutzoom' /*case 'PageLayoutZoom'*/: break;
|
|
|
|
case 'pagebreakzoom' /*case 'PageBreakZoom'*/: break;
|
|
|
|
case 'filteron' /*case 'FilterOn'*/: break;
|
|
|
|
case 'fitwidth' /*case 'FitWidth'*/: break;
|
|
|
|
case 'fitheight' /*case 'FitHeight'*/: break;
|
|
|
|
case 'commentslayout' /*case 'CommentsLayout'*/: break;
|
|
|
|
case 'zoom' /*case 'Zoom'*/: break;
|
|
|
|
case 'lefttoright' /*case 'LeftToRight'*/: break;
|
|
|
|
case 'gridlines' /*case 'Gridlines'*/: break;
|
|
|
|
case 'allowsort' /*case 'AllowSort'*/: break;
|
|
|
|
case 'allowfilter' /*case 'AllowFilter'*/: break;
|
|
|
|
case 'allowinsertrows' /*case 'AllowInsertRows'*/: break;
|
|
|
|
case 'allowdeleterows' /*case 'AllowDeleteRows'*/: break;
|
|
|
|
case 'allowinsertcols' /*case 'AllowInsertCols'*/: break;
|
|
|
|
case 'allowdeletecols' /*case 'AllowDeleteCols'*/: break;
|
|
|
|
case 'allowinserthyperlinks' /*case 'AllowInsertHyperlinks'*/: break;
|
|
|
|
case 'allowformatcells' /*case 'AllowFormatCells'*/: break;
|
|
|
|
case 'allowsizecols' /*case 'AllowSizeCols'*/: break;
|
|
|
|
case 'allowsizerows' /*case 'AllowSizeRows'*/: break;
|
2021-09-22 06:45:08 +00:00
|
|
|
case 'nosummaryrowsbelowdetail' /*case 'NoSummaryRowsBelowDetail'*/:
|
|
|
|
if(!cursheet["!outline"]) cursheet["!outline"] = {};
|
|
|
|
cursheet["!outline"].above = true;
|
|
|
|
break;
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'tabcolorindex' /*case 'TabColorIndex'*/: break;
|
|
|
|
case 'donotdisplayheadings' /*case 'DoNotDisplayHeadings'*/: break;
|
|
|
|
case 'showpagelayoutzoom' /*case 'ShowPageLayoutZoom'*/: break;
|
2021-09-22 06:45:08 +00:00
|
|
|
case 'nosummarycolumnsrightdetail' /*case 'NoSummaryColumnsRightDetail'*/:
|
|
|
|
if(!cursheet["!outline"]) cursheet["!outline"] = {};
|
|
|
|
cursheet["!outline"].left = true;
|
|
|
|
break;
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'blackandwhite' /*case 'BlackAndWhite'*/: break;
|
|
|
|
case 'donotdisplayzeros' /*case 'DoNotDisplayZeros'*/: break;
|
|
|
|
case 'displaypagebreak' /*case 'DisplayPageBreak'*/: break;
|
|
|
|
case 'rowcolheadings' /*case 'RowColHeadings'*/: break;
|
|
|
|
case 'donotdisplayoutline' /*case 'DoNotDisplayOutline'*/: break;
|
|
|
|
case 'noorientation' /*case 'NoOrientation'*/: break;
|
|
|
|
case 'allowusepivottables' /*case 'AllowUsePivotTables'*/: break;
|
|
|
|
case 'zeroheight' /*case 'ZeroHeight'*/: break;
|
|
|
|
case 'viewablerange' /*case 'ViewableRange'*/: break;
|
|
|
|
case 'selection' /*case 'Selection'*/: break;
|
|
|
|
case 'protectcontents' /*case 'ProtectContents'*/: break;
|
2015-04-02 20:32:22 +00:00
|
|
|
default: seen = false;
|
|
|
|
} break;
|
|
|
|
|
|
|
|
/* PivotTable */
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'pivottable' /*case 'PivotTable'*/: case 'pivotcache' /*case 'PivotCache'*/: switch(Rn[3]) {
|
|
|
|
case 'immediateitemsondrop' /*case 'ImmediateItemsOnDrop'*/: break;
|
|
|
|
case 'showpagemultipleitemlabel' /*case 'ShowPageMultipleItemLabel'*/: break;
|
|
|
|
case 'compactrowindent' /*case 'CompactRowIndent'*/: break;
|
|
|
|
case 'location' /*case 'Location'*/: break;
|
|
|
|
case 'pivotfield' /*case 'PivotField'*/: break;
|
|
|
|
case 'orientation' /*case 'Orientation'*/: break;
|
|
|
|
case 'layoutform' /*case 'LayoutForm'*/: break;
|
|
|
|
case 'layoutsubtotallocation' /*case 'LayoutSubtotalLocation'*/: break;
|
|
|
|
case 'layoutcompactrow' /*case 'LayoutCompactRow'*/: break;
|
|
|
|
case 'position' /*case 'Position'*/: break;
|
|
|
|
case 'pivotitem' /*case 'PivotItem'*/: break;
|
|
|
|
case 'datatype' /*case 'DataType'*/: break;
|
|
|
|
case 'datafield' /*case 'DataField'*/: break;
|
|
|
|
case 'sourcename' /*case 'SourceName'*/: break;
|
|
|
|
case 'parentfield' /*case 'ParentField'*/: break;
|
|
|
|
case 'ptlineitems' /*case 'PTLineItems'*/: break;
|
|
|
|
case 'ptlineitem' /*case 'PTLineItem'*/: break;
|
|
|
|
case 'countofsameitems' /*case 'CountOfSameItems'*/: break;
|
|
|
|
case 'item' /*case 'Item'*/: break;
|
|
|
|
case 'itemtype' /*case 'ItemType'*/: break;
|
|
|
|
case 'ptsource' /*case 'PTSource'*/: break;
|
|
|
|
case 'cacheindex' /*case 'CacheIndex'*/: break;
|
|
|
|
case 'consolidationreference' /*case 'ConsolidationReference'*/: break;
|
|
|
|
case 'filename' /*case 'FileName'*/: break;
|
|
|
|
case 'reference' /*case 'Reference'*/: break;
|
|
|
|
case 'nocolumngrand' /*case 'NoColumnGrand'*/: break;
|
|
|
|
case 'norowgrand' /*case 'NoRowGrand'*/: break;
|
|
|
|
case 'blanklineafteritems' /*case 'BlankLineAfterItems'*/: break;
|
|
|
|
case 'hidden' /*case 'Hidden'*/: break;
|
|
|
|
case 'subtotal' /*case 'Subtotal'*/: break;
|
|
|
|
case 'basefield' /*case 'BaseField'*/: break;
|
|
|
|
case 'mapchilditems' /*case 'MapChildItems'*/: break;
|
|
|
|
case 'function' /*case 'Function'*/: break;
|
|
|
|
case 'refreshonfileopen' /*case 'RefreshOnFileOpen'*/: break;
|
|
|
|
case 'printsettitles' /*case 'PrintSetTitles'*/: break;
|
|
|
|
case 'mergelabels' /*case 'MergeLabels'*/: break;
|
|
|
|
case 'defaultversion' /*case 'DefaultVersion'*/: break;
|
|
|
|
case 'refreshname' /*case 'RefreshName'*/: break;
|
|
|
|
case 'refreshdate' /*case 'RefreshDate'*/: break;
|
|
|
|
case 'refreshdatecopy' /*case 'RefreshDateCopy'*/: break;
|
|
|
|
case 'versionlastrefresh' /*case 'VersionLastRefresh'*/: break;
|
|
|
|
case 'versionlastupdate' /*case 'VersionLastUpdate'*/: break;
|
|
|
|
case 'versionupdateablemin' /*case 'VersionUpdateableMin'*/: break;
|
|
|
|
case 'versionrefreshablemin' /*case 'VersionRefreshableMin'*/: break;
|
|
|
|
case 'calculation' /*case 'Calculation'*/: break;
|
2015-04-02 20:32:22 +00:00
|
|
|
default: seen = false;
|
|
|
|
} break;
|
|
|
|
|
|
|
|
/* PageBreaks */
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'pagebreaks' /*case 'PageBreaks'*/: switch(Rn[3]) {
|
|
|
|
case 'colbreaks' /*case 'ColBreaks'*/: break;
|
|
|
|
case 'colbreak' /*case 'ColBreak'*/: break;
|
|
|
|
case 'rowbreaks' /*case 'RowBreaks'*/: break;
|
|
|
|
case 'rowbreak' /*case 'RowBreak'*/: break;
|
|
|
|
case 'colstart' /*case 'ColStart'*/: break;
|
|
|
|
case 'colend' /*case 'ColEnd'*/: break;
|
|
|
|
case 'rowend' /*case 'RowEnd'*/: break;
|
2015-04-02 20:32:22 +00:00
|
|
|
default: seen = false;
|
|
|
|
} break;
|
|
|
|
|
|
|
|
/* AutoFilter */
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'autofilter' /*case 'AutoFilter'*/: switch(Rn[3]) {
|
|
|
|
case 'autofiltercolumn' /*case 'AutoFilterColumn'*/: break;
|
|
|
|
case 'autofiltercondition' /*case 'AutoFilterCondition'*/: break;
|
|
|
|
case 'autofilterand' /*case 'AutoFilterAnd'*/: break;
|
|
|
|
case 'autofilteror' /*case 'AutoFilterOr'*/: break;
|
2015-04-02 20:32:22 +00:00
|
|
|
default: seen = false;
|
|
|
|
} break;
|
|
|
|
|
|
|
|
/* QueryTable */
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'querytable' /*case 'QueryTable'*/: switch(Rn[3]) {
|
|
|
|
case 'id' /*case 'Id'*/: break;
|
|
|
|
case 'autoformatfont' /*case 'AutoFormatFont'*/: break;
|
|
|
|
case 'autoformatpattern' /*case 'AutoFormatPattern'*/: break;
|
|
|
|
case 'querysource' /*case 'QuerySource'*/: break;
|
|
|
|
case 'querytype' /*case 'QueryType'*/: break;
|
|
|
|
case 'enableredirections' /*case 'EnableRedirections'*/: break;
|
|
|
|
case 'refreshedinxl9' /*case 'RefreshedInXl9'*/: break;
|
|
|
|
case 'urlstring' /*case 'URLString'*/: break;
|
|
|
|
case 'htmltables' /*case 'HTMLTables'*/: break;
|
|
|
|
case 'connection' /*case 'Connection'*/: break;
|
|
|
|
case 'commandtext' /*case 'CommandText'*/: break;
|
|
|
|
case 'refreshinfo' /*case 'RefreshInfo'*/: break;
|
|
|
|
case 'notitles' /*case 'NoTitles'*/: break;
|
|
|
|
case 'nextid' /*case 'NextId'*/: break;
|
|
|
|
case 'columninfo' /*case 'ColumnInfo'*/: break;
|
|
|
|
case 'overwritecells' /*case 'OverwriteCells'*/: break;
|
|
|
|
case 'donotpromptforfile' /*case 'DoNotPromptForFile'*/: break;
|
|
|
|
case 'textwizardsettings' /*case 'TextWizardSettings'*/: break;
|
|
|
|
case 'source' /*case 'Source'*/: break;
|
|
|
|
case 'number' /*case 'Number'*/: break;
|
|
|
|
case 'decimal' /*case 'Decimal'*/: break;
|
|
|
|
case 'thousandseparator' /*case 'ThousandSeparator'*/: break;
|
|
|
|
case 'trailingminusnumbers' /*case 'TrailingMinusNumbers'*/: break;
|
|
|
|
case 'formatsettings' /*case 'FormatSettings'*/: break;
|
|
|
|
case 'fieldtype' /*case 'FieldType'*/: break;
|
|
|
|
case 'delimiters' /*case 'Delimiters'*/: break;
|
|
|
|
case 'tab' /*case 'Tab'*/: break;
|
|
|
|
case 'comma' /*case 'Comma'*/: break;
|
|
|
|
case 'autoformatname' /*case 'AutoFormatName'*/: break;
|
|
|
|
case 'versionlastedit' /*case 'VersionLastEdit'*/: break;
|
|
|
|
case 'versionlastrefresh' /*case 'VersionLastRefresh'*/: break;
|
2015-04-02 20:32:22 +00:00
|
|
|
default: seen = false;
|
|
|
|
} break;
|
|
|
|
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'datavalidation' /*case 'DataValidation'*/:
|
2019-11-01 03:09:14 +00:00
|
|
|
switch(Rn[3]) {
|
2020-03-23 01:57:53 +00:00
|
|
|
case 'range' /*case 'Range'*/: break;
|
2020-03-18 06:47:02 +00:00
|
|
|
|
|
|
|
case 'type' /*case 'Type'*/: break;
|
|
|
|
case 'min' /*case 'Min'*/: break;
|
|
|
|
case 'max' /*case 'Max'*/: break;
|
|
|
|
case 'sort' /*case 'Sort'*/: break;
|
|
|
|
case 'descending' /*case 'Descending'*/: break;
|
|
|
|
case 'order' /*case 'Order'*/: break;
|
|
|
|
case 'casesensitive' /*case 'CaseSensitive'*/: break;
|
|
|
|
case 'value' /*case 'Value'*/: break;
|
|
|
|
case 'errorstyle' /*case 'ErrorStyle'*/: break;
|
|
|
|
case 'errormessage' /*case 'ErrorMessage'*/: break;
|
|
|
|
case 'errortitle' /*case 'ErrorTitle'*/: break;
|
|
|
|
case 'inputmessage' /*case 'InputMessage'*/: break;
|
|
|
|
case 'inputtitle' /*case 'InputTitle'*/: break;
|
|
|
|
case 'combohide' /*case 'ComboHide'*/: break;
|
|
|
|
case 'inputhide' /*case 'InputHide'*/: break;
|
|
|
|
case 'condition' /*case 'Condition'*/: break;
|
|
|
|
case 'qualifier' /*case 'Qualifier'*/: break;
|
|
|
|
case 'useblank' /*case 'UseBlank'*/: break;
|
|
|
|
case 'value1' /*case 'Value1'*/: break;
|
|
|
|
case 'value2' /*case 'Value2'*/: break;
|
|
|
|
case 'format' /*case 'Format'*/: break;
|
|
|
|
|
|
|
|
case 'cellrangelist' /*case 'CellRangeList'*/: break;
|
2019-11-01 03:09:14 +00:00
|
|
|
default: seen = false;
|
|
|
|
} break;
|
|
|
|
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'sorting' /*case 'Sorting'*/:
|
|
|
|
case 'conditionalformatting' /*case 'ConditionalFormatting'*/:
|
2017-05-09 18:07:57 +00:00
|
|
|
switch(Rn[3]) {
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'range' /*case 'Range'*/: break;
|
|
|
|
case 'type' /*case 'Type'*/: break;
|
|
|
|
case 'min' /*case 'Min'*/: break;
|
|
|
|
case 'max' /*case 'Max'*/: break;
|
|
|
|
case 'sort' /*case 'Sort'*/: break;
|
|
|
|
case 'descending' /*case 'Descending'*/: break;
|
|
|
|
case 'order' /*case 'Order'*/: break;
|
|
|
|
case 'casesensitive' /*case 'CaseSensitive'*/: break;
|
|
|
|
case 'value' /*case 'Value'*/: break;
|
|
|
|
case 'errorstyle' /*case 'ErrorStyle'*/: break;
|
|
|
|
case 'errormessage' /*case 'ErrorMessage'*/: break;
|
|
|
|
case 'errortitle' /*case 'ErrorTitle'*/: break;
|
|
|
|
case 'cellrangelist' /*case 'CellRangeList'*/: break;
|
|
|
|
case 'inputmessage' /*case 'InputMessage'*/: break;
|
|
|
|
case 'inputtitle' /*case 'InputTitle'*/: break;
|
|
|
|
case 'combohide' /*case 'ComboHide'*/: break;
|
|
|
|
case 'inputhide' /*case 'InputHide'*/: break;
|
|
|
|
case 'condition' /*case 'Condition'*/: break;
|
|
|
|
case 'qualifier' /*case 'Qualifier'*/: break;
|
|
|
|
case 'useblank' /*case 'UseBlank'*/: break;
|
|
|
|
case 'value1' /*case 'Value1'*/: break;
|
|
|
|
case 'value2' /*case 'Value2'*/: break;
|
|
|
|
case 'format' /*case 'Format'*/: break;
|
2015-04-02 20:32:22 +00:00
|
|
|
default: seen = false;
|
|
|
|
} break;
|
|
|
|
|
|
|
|
/* MapInfo (schema) */
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'mapinfo' /*case 'MapInfo'*/: case 'schema' /*case 'Schema'*/: case 'data' /*case 'data'*/: switch(Rn[3]) {
|
|
|
|
case 'map' /*case 'Map'*/: break;
|
|
|
|
case 'entry' /*case 'Entry'*/: break;
|
|
|
|
case 'range' /*case 'Range'*/: break;
|
|
|
|
case 'xpath' /*case 'XPath'*/: break;
|
|
|
|
case 'field' /*case 'Field'*/: break;
|
|
|
|
case 'xsdtype' /*case 'XSDType'*/: break;
|
|
|
|
case 'filteron' /*case 'FilterOn'*/: break;
|
|
|
|
case 'aggregate' /*case 'Aggregate'*/: break;
|
|
|
|
case 'elementtype' /*case 'ElementType'*/: break;
|
|
|
|
case 'attributetype' /*case 'AttributeType'*/: break;
|
2015-04-02 20:32:22 +00:00
|
|
|
/* These are from xsd (XML Schema Definition) */
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'schema' /*case 'schema'*/:
|
|
|
|
case 'element' /*case 'element'*/:
|
|
|
|
case 'complextype' /*case 'complexType'*/:
|
|
|
|
case 'datatype' /*case 'datatype'*/:
|
|
|
|
case 'all' /*case 'all'*/:
|
|
|
|
case 'attribute' /*case 'attribute'*/:
|
|
|
|
case 'extends' /*case 'extends'*/: break;
|
|
|
|
|
|
|
|
case 'row' /*case 'row'*/: break;
|
2015-04-02 20:32:22 +00:00
|
|
|
default: seen = false;
|
|
|
|
} break;
|
|
|
|
|
|
|
|
/* SmartTags (can be anything) */
|
2020-03-18 06:47:02 +00:00
|
|
|
case 'smarttags' /*case 'SmartTags'*/: break;
|
2015-04-02 20:32:22 +00:00
|
|
|
|
|
|
|
default: seen = false; break;
|
|
|
|
}
|
|
|
|
if(seen) break;
|
|
|
|
/* CustomDocumentProperties */
|
2019-11-01 03:09:14 +00:00
|
|
|
if(Rn[3].match(/!\[CDATA/)) break;
|
2015-04-02 20:32:22 +00:00
|
|
|
if(!state[state.length-1][1]) throw 'Unrecognized tag: ' + Rn[3] + "|" + state.join("|");
|
2020-03-18 06:47:02 +00:00
|
|
|
if(state[state.length-1][0]===/*'CustomDocumentProperties'*/'customdocumentproperties') {
|
2017-02-22 06:57:59 +00:00
|
|
|
if(Rn[0].slice(-2) === "/>") break;
|
2020-03-18 06:47:02 +00:00
|
|
|
else if(Rn[1]==="/") xlml_set_custprop(Custprops, raw_Rn3, cp, str.slice(pidx, Rn.index));
|
2015-04-02 20:32:22 +00:00
|
|
|
else { cp = Rn; pidx = Rn.index + Rn[0].length; }
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if(opts.WTF) throw 'Unrecognized tag: ' + Rn[3] + "|" + state.join("|");
|
|
|
|
}
|
2017-03-05 00:56:31 +00:00
|
|
|
var out = ({}/*:any*/);
|
2015-04-02 20:32:22 +00:00
|
|
|
if(!opts.bookSheets && !opts.bookProps) out.Sheets = sheets;
|
|
|
|
out.SheetNames = sheetnames;
|
2017-03-31 18:46:42 +00:00
|
|
|
out.Workbook = Workbook;
|
2015-04-02 20:32:22 +00:00
|
|
|
out.SSF = SSF.get_table();
|
|
|
|
out.Props = Props;
|
|
|
|
out.Custprops = Custprops;
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
2017-08-05 06:32:57 +00:00
|
|
|
function parse_xlml(data/*:RawBytes|string*/, opts)/*:Workbook*/ {
|
2015-04-02 20:32:22 +00:00
|
|
|
fix_read_opts(opts=opts||{});
|
|
|
|
switch(opts.type||"base64") {
|
|
|
|
case "base64": return parse_xlml_xml(Base64.decode(data), opts);
|
|
|
|
case "binary": case "buffer": case "file": return parse_xlml_xml(data, opts);
|
2018-02-03 20:46:32 +00:00
|
|
|
case "array": return parse_xlml_xml(a2s(data), opts);
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
2017-03-12 18:02:43 +00:00
|
|
|
/*:: throw new Error("unsupported type " + opts.type); */
|
2015-04-02 20:32:22 +00:00
|
|
|
}
|
|
|
|
|
2017-02-22 06:57:59 +00:00
|
|
|
/* TODO */
|
2017-12-30 05:40:35 +00:00
|
|
|
function write_props_xlml(wb/*:Workbook*/, opts)/*:string*/ {
|
|
|
|
var o/*:Array<string>*/ = [];
|
2017-03-14 08:19:51 +00:00
|
|
|
/* DocumentProperties */
|
2017-04-10 05:10:54 +00:00
|
|
|
if(wb.Props) o.push(xlml_write_docprops(wb.Props, opts));
|
2017-03-14 08:19:51 +00:00
|
|
|
/* CustomDocumentProperties */
|
2017-04-11 22:15:36 +00:00
|
|
|
if(wb.Custprops) o.push(xlml_write_custprops(wb.Props, wb.Custprops, opts));
|
2017-03-14 08:19:51 +00:00
|
|
|
return o.join("");
|
|
|
|
}
|
|
|
|
/* TODO */
|
2018-01-23 09:07:51 +00:00
|
|
|
function write_wb_xlml(/*::wb, opts*/)/*:string*/ {
|
2017-03-14 08:19:51 +00:00
|
|
|
/* OfficeDocumentSettings */
|
|
|
|
/* ExcelWorkbook */
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
/* TODO */
|
|
|
|
function write_sty_xlml(wb, opts)/*:string*/ {
|
|
|
|
/* Styles */
|
2017-12-30 05:40:35 +00:00
|
|
|
var styles/*:Array<string>*/ = ['<Style ss:ID="Default" ss:Name="Normal"><NumberFormat/></Style>'];
|
|
|
|
opts.cellXfs.forEach(function(xf, id) {
|
|
|
|
var payload/*:Array<string>*/ = [];
|
|
|
|
payload.push(writextag('NumberFormat', null, {"ss:Format": escapexml(SSF._table[xf.numFmtId])}));
|
2020-03-15 07:42:05 +00:00
|
|
|
|
|
|
|
var o = /*::(*/{"ss:ID": "s" + (21+id)}/*:: :any)*/;
|
|
|
|
styles.push(writextag('Style', payload.join(""), o));
|
2017-12-30 05:40:35 +00:00
|
|
|
});
|
|
|
|
return writextag("Styles", styles.join(""));
|
2017-03-14 08:19:51 +00:00
|
|
|
}
|
2018-01-09 07:36:02 +00:00
|
|
|
function write_name_xlml(n) { return writextag("NamedRange", null, {"ss:Name": n.Name, "ss:RefersTo":"=" + a1_to_rc(n.Ref, {r:0,c:0})}); }
|
2018-01-23 09:07:51 +00:00
|
|
|
function write_names_xlml(wb/*::, opts*/)/*:string*/ {
|
2018-01-09 07:36:02 +00:00
|
|
|
if(!((wb||{}).Workbook||{}).Names) return "";
|
|
|
|
/*:: if(!wb || !wb.Workbook || !wb.Workbook.Names) throw new Error("unreachable"); */
|
|
|
|
var names/*:Array<any>*/ = wb.Workbook.Names;
|
|
|
|
var out/*:Array<string>*/ = [];
|
|
|
|
for(var i = 0; i < names.length; ++i) {
|
|
|
|
var n = names[i];
|
|
|
|
if(n.Sheet != null) continue;
|
|
|
|
if(n.Name.match(/^_xlfn\./)) continue;
|
|
|
|
out.push(write_name_xlml(n));
|
|
|
|
}
|
|
|
|
return writextag("Names", out.join(""));
|
|
|
|
}
|
|
|
|
function write_ws_xlml_names(ws/*:Worksheet*/, opts, idx/*:number*/, wb/*:Workbook*/)/*:string*/ {
|
|
|
|
if(!ws) return "";
|
|
|
|
if(!((wb||{}).Workbook||{}).Names) return "";
|
|
|
|
/*:: if(!wb || !wb.Workbook || !wb.Workbook.Names) throw new Error("unreachable"); */
|
|
|
|
var names/*:Array<any>*/ = wb.Workbook.Names;
|
|
|
|
var out/*:Array<string>*/ = [];
|
2018-08-25 23:44:35 +00:00
|
|
|
for(var i = 0; i < names.length; ++i) {
|
2018-01-09 07:36:02 +00:00
|
|
|
var n = names[i];
|
|
|
|
if(n.Sheet != idx) continue;
|
|
|
|
/*switch(n.Name) {
|
|
|
|
case "_": continue;
|
|
|
|
}*/
|
|
|
|
if(n.Name.match(/^_xlfn\./)) continue;
|
|
|
|
out.push(write_name_xlml(n));
|
|
|
|
}
|
|
|
|
return out.join("");
|
|
|
|
}
|
2017-03-31 18:46:42 +00:00
|
|
|
/* WorksheetOptions */
|
|
|
|
function write_ws_xlml_wsopts(ws/*:Worksheet*/, opts, idx/*:number*/, wb/*:Workbook*/)/*:string*/ {
|
2017-04-26 02:27:12 +00:00
|
|
|
if(!ws) return "";
|
2017-12-30 05:40:35 +00:00
|
|
|
var o/*:Array<string>*/ = [];
|
2017-04-26 02:27:12 +00:00
|
|
|
/* NOTE: spec technically allows any order, but stick with implied order */
|
|
|
|
|
|
|
|
/* FitToPage */
|
|
|
|
/* DoNotDisplayColHeaders */
|
|
|
|
/* DoNotDisplayRowHeaders */
|
|
|
|
/* ViewableRange */
|
|
|
|
/* Selection */
|
|
|
|
/* GridlineColor */
|
|
|
|
/* Name */
|
|
|
|
/* ExcelWorksheetType */
|
|
|
|
/* IntlMacro */
|
|
|
|
/* Unsynced */
|
|
|
|
/* Selected */
|
|
|
|
/* CodeName */
|
|
|
|
|
|
|
|
if(ws['!margins']) {
|
|
|
|
o.push("<PageSetup>");
|
|
|
|
if(ws['!margins'].header) o.push(writextag("Header", null, {'x:Margin':ws['!margins'].header}));
|
|
|
|
if(ws['!margins'].footer) o.push(writextag("Footer", null, {'x:Margin':ws['!margins'].footer}));
|
|
|
|
o.push(writextag("PageMargins", null, {
|
|
|
|
'x:Bottom': ws['!margins'].bottom || "0.75",
|
|
|
|
'x:Left': ws['!margins'].left || "0.7",
|
|
|
|
'x:Right': ws['!margins'].right || "0.7",
|
|
|
|
'x:Top': ws['!margins'].top || "0.75"
|
|
|
|
}));
|
|
|
|
o.push("</PageSetup>");
|
|
|
|
}
|
|
|
|
|
2017-03-31 18:46:42 +00:00
|
|
|
/* PageSetup */
|
2017-04-26 02:27:12 +00:00
|
|
|
/* DisplayPageBreak */
|
|
|
|
/* TransitionExpressionEvaluation */
|
|
|
|
/* TransitionFormulaEntry */
|
|
|
|
/* Print */
|
|
|
|
/* Zoom */
|
|
|
|
/* PageLayoutZoom */
|
|
|
|
/* PageBreakZoom */
|
|
|
|
/* ShowPageBreakZoom */
|
|
|
|
/* DefaultRowHeight */
|
|
|
|
/* DefaultColumnWidth */
|
|
|
|
/* StandardWidth */
|
|
|
|
|
2017-03-31 18:46:42 +00:00
|
|
|
if(wb && wb.Workbook && wb.Workbook.Sheets && wb.Workbook.Sheets[idx]) {
|
|
|
|
/* Visible */
|
2017-05-09 18:07:57 +00:00
|
|
|
if(wb.Workbook.Sheets[idx].Hidden) o.push(writextag("Visible", (wb.Workbook.Sheets[idx].Hidden == 1 ? "SheetHidden" : "SheetVeryHidden"), {}));
|
2017-03-31 18:46:42 +00:00
|
|
|
else {
|
|
|
|
/* Selected */
|
|
|
|
for(var i = 0; i < idx; ++i) if(wb.Workbook.Sheets[i] && !wb.Workbook.Sheets[i].Hidden) break;
|
|
|
|
if(i == idx) o.push("<Selected/>");
|
|
|
|
}
|
|
|
|
}
|
2017-04-26 02:27:12 +00:00
|
|
|
|
|
|
|
/* LeftColumnVisible */
|
2017-12-30 05:40:35 +00:00
|
|
|
|
|
|
|
if(((((wb||{}).Workbook||{}).Views||[])[0]||{}).RTL) o.push("<DisplayRightToLeft/>");
|
|
|
|
|
2017-04-26 02:27:12 +00:00
|
|
|
/* GridlineColorIndex */
|
|
|
|
/* DisplayFormulas */
|
|
|
|
/* DoNotDisplayGridlines */
|
|
|
|
/* DoNotDisplayHeadings */
|
|
|
|
/* DoNotDisplayOutline */
|
|
|
|
/* ApplyAutomaticOutlineStyles */
|
|
|
|
/* NoSummaryRowsBelowDetail */
|
|
|
|
/* NoSummaryColumnsRightDetail */
|
|
|
|
/* DoNotDisplayZeros */
|
|
|
|
/* ActiveRow */
|
|
|
|
/* ActiveColumn */
|
|
|
|
/* FilterOn */
|
|
|
|
/* RangeSelection */
|
|
|
|
/* TopRowVisible */
|
|
|
|
/* TopRowBottomPane */
|
|
|
|
/* LeftColumnRightPane */
|
|
|
|
/* ActivePane */
|
|
|
|
/* SplitHorizontal */
|
|
|
|
/* SplitVertical */
|
|
|
|
/* FreezePanes */
|
|
|
|
/* FrozenNoSplit */
|
|
|
|
/* TabColorIndex */
|
|
|
|
/* Panes */
|
|
|
|
|
|
|
|
/* NOTE: Password not supported in XLML Format */
|
|
|
|
if(ws['!protect']) {
|
|
|
|
o.push(writetag("ProtectContents", "True"));
|
|
|
|
if(ws['!protect'].objects) o.push(writetag("ProtectObjects", "True"));
|
|
|
|
if(ws['!protect'].scenarios) o.push(writetag("ProtectScenarios", "True"));
|
|
|
|
if(ws['!protect'].selectLockedCells != null && !ws['!protect'].selectLockedCells) o.push(writetag("EnableSelection", "NoSelection"));
|
|
|
|
else if(ws['!protect'].selectUnlockedCells != null && !ws['!protect'].selectUnlockedCells) o.push(writetag("EnableSelection", "UnlockedCells"));
|
|
|
|
[
|
2017-10-16 22:19:53 +00:00
|
|
|
[ "formatCells", "AllowFormatCells" ],
|
|
|
|
[ "formatColumns", "AllowSizeCols" ],
|
|
|
|
[ "formatRows", "AllowSizeRows" ],
|
2017-04-26 02:27:12 +00:00
|
|
|
[ "insertColumns", "AllowInsertCols" ],
|
|
|
|
[ "insertRows", "AllowInsertRows" ],
|
|
|
|
[ "insertHyperlinks", "AllowInsertHyperlinks" ],
|
|
|
|
[ "deleteColumns", "AllowDeleteCols" ],
|
|
|
|
[ "deleteRows", "AllowDeleteRows" ],
|
|
|
|
[ "sort", "AllowSort" ],
|
|
|
|
[ "autoFilter", "AllowFilter" ],
|
|
|
|
[ "pivotTables", "AllowUsePivotTables" ]
|
|
|
|
].forEach(function(x) { if(ws['!protect'][x[0]]) o.push("<"+x[1]+"/>"); });
|
|
|
|
}
|
|
|
|
|
2017-03-31 18:46:42 +00:00
|
|
|
if(o.length == 0) return "";
|
|
|
|
return writextag("WorksheetOptions", o.join(""), {xmlns:XLMLNS.x});
|
|
|
|
}
|
2017-12-15 01:18:40 +00:00
|
|
|
function write_ws_xlml_comment(comments/*:Array<any>*/)/*:string*/ {
|
2017-04-02 06:47:25 +00:00
|
|
|
return comments.map(function(c) {
|
|
|
|
// TODO: formatted text
|
|
|
|
var t = xlml_unfixstr(c.t||"");
|
|
|
|
var d =writextag("ss:Data", t, {"xmlns":"http://www.w3.org/TR/REC-html40"});
|
|
|
|
return writextag("Comment", d, {"ss:Author":c.a});
|
|
|
|
}).join("");
|
|
|
|
}
|
2017-12-15 01:18:40 +00:00
|
|
|
function write_ws_xlml_cell(cell, ref/*:string*/, ws, opts, idx/*:number*/, wb, addr)/*:string*/{
|
2018-02-08 18:21:39 +00:00
|
|
|
if(!cell || (cell.v == undefined && cell.f == undefined)) return "";
|
2017-03-14 08:19:51 +00:00
|
|
|
|
|
|
|
var attr = {};
|
|
|
|
if(cell.f) attr["ss:Formula"] = "=" + escapexml(a1_to_rc(cell.f, addr));
|
2018-01-11 08:01:25 +00:00
|
|
|
if(cell.F && cell.F.slice(0, ref.length) == ref) {
|
|
|
|
var end = decode_cell(cell.F.slice(ref.length + 1));
|
2017-03-18 00:45:06 +00:00
|
|
|
attr["ss:ArrayRange"] = "RC:R" + (end.r == addr.r ? "" : "[" + (end.r - addr.r) + "]") + "C" + (end.c == addr.c ? "" : "[" + (end.c - addr.c) + "]");
|
|
|
|
}
|
2017-03-14 08:19:51 +00:00
|
|
|
|
2017-03-28 22:03:03 +00:00
|
|
|
if(cell.l && cell.l.Target) {
|
|
|
|
attr["ss:HRef"] = escapexml(cell.l.Target);
|
|
|
|
if(cell.l.Tooltip) attr["x:HRefScreenTip"] = escapexml(cell.l.Tooltip);
|
|
|
|
}
|
|
|
|
|
2017-03-16 01:17:24 +00:00
|
|
|
if(ws['!merges']) {
|
|
|
|
var marr = ws['!merges'];
|
|
|
|
for(var mi = 0; mi != marr.length; ++mi) {
|
|
|
|
if(marr[mi].s.c != addr.c || marr[mi].s.r != addr.r) continue;
|
|
|
|
if(marr[mi].e.c > marr[mi].s.c) attr['ss:MergeAcross'] = marr[mi].e.c - marr[mi].s.c;
|
|
|
|
if(marr[mi].e.r > marr[mi].s.r) attr['ss:MergeDown'] = marr[mi].e.r - marr[mi].s.r;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-14 08:19:51 +00:00
|
|
|
var t = "", p = "";
|
|
|
|
switch(cell.t) {
|
2019-11-01 03:09:14 +00:00
|
|
|
case 'z': if(!opts.sheetStubs) return ""; break;
|
2017-03-14 08:19:51 +00:00
|
|
|
case 'n': t = 'Number'; p = String(cell.v); break;
|
|
|
|
case 'b': t = 'Boolean'; p = (cell.v ? "1" : "0"); break;
|
|
|
|
case 'e': t = 'Error'; p = BErr[cell.v]; break;
|
2017-12-30 05:40:35 +00:00
|
|
|
case 'd': t = 'DateTime'; p = new Date(cell.v).toISOString(); if(cell.z == null) cell.z = cell.z || SSF._table[14]; break;
|
2018-01-09 07:36:02 +00:00
|
|
|
case 's': t = 'String'; p = escapexlml(cell.v||""); break;
|
2017-03-14 08:19:51 +00:00
|
|
|
}
|
2017-12-30 05:40:35 +00:00
|
|
|
/* TODO: cell style */
|
|
|
|
var os = get_cell_style(opts.cellXfs, cell, opts);
|
|
|
|
attr["ss:StyleID"] = "s" + (21+os);
|
2018-01-09 07:36:02 +00:00
|
|
|
attr["ss:Index"] = addr.c + 1;
|
2017-03-20 21:42:12 +00:00
|
|
|
var _v = (cell.v != null ? p : "");
|
2019-11-01 03:09:14 +00:00
|
|
|
var m = cell.t == 'z' ? "" : ('<Data ss:Type="' + t + '">' + _v + '</Data>');
|
2017-03-14 08:19:51 +00:00
|
|
|
|
2017-04-02 06:47:25 +00:00
|
|
|
if((cell.c||[]).length > 0) m += write_ws_xlml_comment(cell.c);
|
|
|
|
|
2017-03-14 08:19:51 +00:00
|
|
|
return writextag("Cell", m, attr);
|
|
|
|
}
|
2017-04-28 07:28:03 +00:00
|
|
|
function write_ws_xlml_row(R/*:number*/, row)/*:string*/ {
|
|
|
|
var o = '<Row ss:Index="' + (R+1) + '"';
|
|
|
|
if(row) {
|
|
|
|
if(row.hpt && !row.hpx) row.hpx = pt2px(row.hpt);
|
|
|
|
if(row.hpx) o += ' ss:AutoFitHeight="0" ss:Height="' + row.hpx + '"';
|
|
|
|
if(row.hidden) o += ' ss:Hidden="1"';
|
|
|
|
}
|
|
|
|
return o + '>';
|
|
|
|
}
|
2017-03-14 08:19:51 +00:00
|
|
|
/* TODO */
|
|
|
|
function write_ws_xlml_table(ws/*:Worksheet*/, opts, idx/*:number*/, wb/*:Workbook*/)/*:string*/ {
|
|
|
|
if(!ws['!ref']) return "";
|
2017-12-30 05:40:35 +00:00
|
|
|
var range/*:Range*/ = safe_decode_range(ws['!ref']);
|
|
|
|
var marr/*:Array<Range>*/ = ws['!merges'] || [], mi = 0;
|
|
|
|
var o/*:Array<string>*/ = [];
|
2017-03-28 22:03:03 +00:00
|
|
|
if(ws['!cols']) ws['!cols'].forEach(function(n, i) {
|
2017-04-28 07:28:03 +00:00
|
|
|
process_col(n);
|
|
|
|
var w = !!n.width;
|
2017-03-28 22:03:03 +00:00
|
|
|
var p = col_obj_w(i, n);
|
2017-05-13 18:21:22 +00:00
|
|
|
var k/*:any*/ = {"ss:Index":i+1};
|
2017-04-28 07:28:03 +00:00
|
|
|
if(w) k['ss:Width'] = width2px(p.width);
|
|
|
|
if(n.hidden) k['ss:Hidden']="1";
|
|
|
|
o.push(writextag("Column",null,k));
|
2017-03-28 22:03:03 +00:00
|
|
|
});
|
2017-04-08 06:55:35 +00:00
|
|
|
var dense = Array.isArray(ws);
|
2017-03-14 08:19:51 +00:00
|
|
|
for(var R = range.s.r; R <= range.e.r; ++R) {
|
2017-04-28 07:28:03 +00:00
|
|
|
var row = [write_ws_xlml_row(R, (ws['!rows']||[])[R])];
|
2017-03-14 08:19:51 +00:00
|
|
|
for(var C = range.s.c; C <= range.e.c; ++C) {
|
2017-03-16 01:17:24 +00:00
|
|
|
var skip = false;
|
|
|
|
for(mi = 0; mi != marr.length; ++mi) {
|
|
|
|
if(marr[mi].s.c > C) continue;
|
|
|
|
if(marr[mi].s.r > R) continue;
|
|
|
|
if(marr[mi].e.c < C) continue;
|
|
|
|
if(marr[mi].e.r < R) continue;
|
|
|
|
if(marr[mi].s.c != C || marr[mi].s.r != R) skip = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if(skip) continue;
|
2017-03-14 08:19:51 +00:00
|
|
|
var addr = {r:R,c:C};
|
2017-04-08 06:55:35 +00:00
|
|
|
var ref = encode_cell(addr), cell = dense ? (ws[R]||[])[C] : ws[ref];
|
|
|
|
row.push(write_ws_xlml_cell(cell, ref, ws, opts, idx, wb, addr));
|
2017-03-14 08:19:51 +00:00
|
|
|
}
|
|
|
|
row.push("</Row>");
|
2017-03-16 01:17:24 +00:00
|
|
|
if(row.length > 2) o.push(row.join(""));
|
2017-03-14 08:19:51 +00:00
|
|
|
}
|
2017-02-10 19:23:01 +00:00
|
|
|
return o.join("");
|
|
|
|
}
|
2017-03-14 08:19:51 +00:00
|
|
|
function write_ws_xlml(idx/*:number*/, opts, wb/*:Workbook*/)/*:string*/ {
|
2017-12-30 05:40:35 +00:00
|
|
|
var o/*:Array<string>*/ = [];
|
2017-03-14 08:19:51 +00:00
|
|
|
var s = wb.SheetNames[idx];
|
|
|
|
var ws = wb.Sheets[s];
|
|
|
|
|
2018-01-09 07:36:02 +00:00
|
|
|
var t/*:string*/ = ws ? write_ws_xlml_names(ws, opts, idx, wb) : "";
|
|
|
|
if(t.length > 0) o.push("<Names>" + t + "</Names>");
|
|
|
|
|
2017-03-14 08:19:51 +00:00
|
|
|
/* Table */
|
2018-01-09 07:36:02 +00:00
|
|
|
t = ws ? write_ws_xlml_table(ws, opts, idx, wb) : "";
|
2017-03-14 08:19:51 +00:00
|
|
|
if(t.length > 0) o.push("<Table>" + t + "</Table>");
|
2017-03-31 18:46:42 +00:00
|
|
|
|
2017-03-14 08:19:51 +00:00
|
|
|
/* WorksheetOptions */
|
2017-03-31 18:46:42 +00:00
|
|
|
o.push(write_ws_xlml_wsopts(ws, opts, idx, wb));
|
|
|
|
|
2017-03-14 08:19:51 +00:00
|
|
|
return o.join("");
|
|
|
|
}
|
|
|
|
function write_xlml(wb, opts)/*:string*/ {
|
2017-12-30 05:40:35 +00:00
|
|
|
if(!opts) opts = {};
|
|
|
|
if(!wb.SSF) wb.SSF = SSF.get_table();
|
|
|
|
if(wb.SSF) {
|
|
|
|
make_ssf(SSF); SSF.load_table(wb.SSF);
|
|
|
|
// $FlowIgnore
|
|
|
|
opts.revssf = evert_num(wb.SSF); opts.revssf[wb.SSF[65535]] = 0;
|
|
|
|
opts.ssf = wb.SSF;
|
|
|
|
opts.cellXfs = [];
|
|
|
|
get_cell_style(opts.cellXfs, {}, {revssf:{"General":0}});
|
|
|
|
}
|
|
|
|
var d/*:Array<string>*/ = [];
|
2017-03-14 08:19:51 +00:00
|
|
|
d.push(write_props_xlml(wb, opts));
|
|
|
|
d.push(write_wb_xlml(wb, opts));
|
2017-12-30 05:40:35 +00:00
|
|
|
d.push("");
|
2018-01-09 07:36:02 +00:00
|
|
|
d.push("");
|
2017-03-14 08:19:51 +00:00
|
|
|
for(var i = 0; i < wb.SheetNames.length; ++i)
|
|
|
|
d.push(writextag("Worksheet", write_ws_xlml(i, opts, wb), {"ss:Name":escapexml(wb.SheetNames[i])}));
|
2017-12-30 05:40:35 +00:00
|
|
|
d[2] = write_sty_xlml(wb, opts);
|
2018-01-09 07:36:02 +00:00
|
|
|
d[3] = write_names_xlml(wb, opts);
|
2017-03-14 08:19:51 +00:00
|
|
|
return XML_HEADER + writextag("Workbook", d.join(""), {
|
|
|
|
'xmlns': XLMLNS.ss,
|
|
|
|
'xmlns:o': XLMLNS.o,
|
|
|
|
'xmlns:x': XLMLNS.x,
|
|
|
|
'xmlns:ss': XLMLNS.ss,
|
|
|
|
'xmlns:dt': XLMLNS.dt,
|
|
|
|
'xmlns:html': XLMLNS.html
|
|
|
|
});
|
|
|
|
}
|