forked from sheetjs/sheetjs
version bump 0.18.4
This commit is contained in:
parent
2cbc28d6ed
commit
61b17a8bc8
2
Makefile
2
Makefile
@ -186,7 +186,7 @@ fullint: lint mdlint ## Run all checks (removed: old-lint, tslint, flow)
|
||||
|
||||
.PHONY: lint
|
||||
lint: $(TARGET) $(AUXTARGETS) ## Run eslint checks
|
||||
@./node_modules/.bin/eslint --ext .js,.njs,.json,.html,.htm $(TARGET) $(AUXTARGETS) $(CMDS) $(HTMLLINT) package.json bower.json
|
||||
@./node_modules/.bin/eslint --ext .js,.njs,.json,.html,.htm $(FLOWTARGET) $(AUXTARGETS) $(CMDS) $(HTMLLINT) package.json bower.json
|
||||
@if [ -x "$(CLOSURE)" ]; then java -jar $(CLOSURE) $(REQS) $(FLOWTARGET) --jscomp_warning=reportUnknownTypes >/dev/null; fi
|
||||
|
||||
.PHONY: old-lint
|
||||
|
@ -578,6 +578,7 @@ The [`demos` directory](demos/) includes sample projects for:
|
||||
- [`canvas-datagrid`](demos/datagrid/)
|
||||
- [`x-spreadsheet`](demos/xspreadsheet/)
|
||||
- [`react-data-grid`](demos/react/modify/)
|
||||
- [`vue3-table-light`](demos/vue/modify/)
|
||||
- [`Swift JSC and other engines`](demos/altjs/)
|
||||
- [`"serverless" functions`](demos/function/)
|
||||
- [`internet explorer`](demos/oldie/)
|
||||
@ -1831,6 +1832,14 @@ export default function App() {
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Previewing data in a VueJS data grid</b> (click to show)</summary>
|
||||
|
||||
[`vue3-table-lite`](https://github.com/linmasahiro/vue3-table-lite) is a simple
|
||||
VueJS 3 data table. It is featured [in the VueJS demo](/demos/vue/modify/).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Populating a database (SQL or no-SQL)</b> (click to show)</summary>
|
||||
|
||||
|
@ -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, ArrayBuffer:false, Deno:false */
|
||||
/*global exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false, DataView:false, Deno:false */
|
||||
var XLSX = {};
|
||||
function make_xlsx_lib(XLSX){
|
||||
|
@ -1 +1 @@
|
||||
XLSX.version = '0.18.3';
|
||||
XLSX.version = '0.18.4';
|
||||
|
@ -21,7 +21,7 @@ declare var Buffer_from:any;
|
||||
/* vim: set ts=2: */
|
||||
/*jshint eqnull:true */
|
||||
/*exported CFB */
|
||||
/*global module, require:false, process:false, Buffer:false, Uint8Array:false, Uint16Array:false */
|
||||
/*global Uint8Array:false, Uint16Array:false */
|
||||
|
||||
/*::
|
||||
type SectorEntry = {
|
||||
|
@ -129,8 +129,7 @@ function fill(c/*:string*/,l/*:number*/)/*:string*/ { var o = ""; while(o.length
|
||||
/* TODO: stress test */
|
||||
function fuzzynum(s/*:string*/)/*:number*/ {
|
||||
var v/*:number*/ = Number(s);
|
||||
if(isFinite(v)) return v;
|
||||
if(!isNaN(v)) return NaN;
|
||||
if(!isNaN(v)) return isFinite(v) ? v : NaN;
|
||||
if(!/\d/.test(s)) return v;
|
||||
var wt = 1;
|
||||
var ss = s.replace(/([\d]),([\d])/g,"$1$2").replace(/[$]/g,"").replace(/[%]/g, function() { wt *= 100; return "";});
|
||||
|
@ -81,7 +81,7 @@ var xlml_fixstr/*:StringConv*/ = /*#__PURE__*/(function() {
|
||||
function entrepl($$/*:string*/,$1/*:string*/)/*:string*/ { return String.fromCharCode(parseInt($1,10)); }
|
||||
return function xlml_fixstr(str/*:string*/)/*:string*/ { return str.replace(entregex,entrepl); };
|
||||
})();
|
||||
function xlml_unfixstr(str/*:string*/)/*:string*/ { return str.replace(/(\r\n|[\r\n])/g,"\ "); };
|
||||
function xlml_unfixstr(str/*:string*/)/*:string*/ { return str.replace(/(\r\n|[\r\n])/g,"\ "); }
|
||||
|
||||
function parsexmlbool(value/*:any*/)/*:boolean*/ {
|
||||
switch(value) {
|
||||
|
@ -94,10 +94,6 @@ var ct2type/*{[string]:string}*/ = ({
|
||||
"application/vnd.ms-excel.externalLink": "links",
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml": "links",
|
||||
|
||||
/* Metadata */
|
||||
"application/vnd.ms-excel.sheetMetadata": "metadata",
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml": "metadata",
|
||||
|
||||
/* PivotCache */
|
||||
"application/vnd.ms-excel.pivotCacheDefinition": "TODO",
|
||||
"application/vnd.ms-excel.pivotCacheRecords": "TODO",
|
||||
|
@ -17,7 +17,7 @@ var RELS = ({
|
||||
STY: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",
|
||||
THEME: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",
|
||||
CHART: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",
|
||||
CHARTEX: "http://schemas.microsoft.com/office/2014/relationships/chartEx",
|
||||
CHARTEX: "http://schemas.microsoft.com/office/2014/relationships/chartEx",
|
||||
CS: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet",
|
||||
WS: [
|
||||
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",
|
||||
|
@ -373,10 +373,10 @@ var WK_ = /*#__PURE__*/(function() {
|
||||
V = (rel ? B : 0) + ((V >= 0x2000) ? V - 0x4000 : V);
|
||||
return (rel ? "" : "$") + (col ? encode_col(V) : encode_row(V));
|
||||
}
|
||||
var oprec = [
|
||||
/* var oprec = [
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 6, 4, 4, 5, 5, 7, 3, 3,
|
||||
3, 3, 3, 3, 1, 1, 2, 6, 8, 8, 8, 8, 8, 8, 8, 8
|
||||
];
|
||||
]; */
|
||||
/* TODO: flesh out */
|
||||
var FuncTab = {
|
||||
0x33: ["FALSE", 0],
|
||||
@ -390,10 +390,10 @@ var WK_ = /*#__PURE__*/(function() {
|
||||
0x6F: ["T", 1]
|
||||
};
|
||||
var BinOpTab = [
|
||||
"", "", "", "", "", "", "", "",
|
||||
"", "+", "-", "*", "/", "^", "=", "<>",
|
||||
"<=", ">=", "<", ">", "", "", "", "",
|
||||
"&", "", "", "", "", "", "", ""
|
||||
"", "", "", "", "", "", "", "", // eslint-disable-line no-mixed-spaces-and-tabs
|
||||
"", "+", "-", "*", "/", "^", "=", "<>", // eslint-disable-line no-mixed-spaces-and-tabs
|
||||
"<=", ">=", "<", ">", "", "", "", "", // eslint-disable-line no-mixed-spaces-and-tabs
|
||||
"&", "", "", "", "", "", "", "" // eslint-disable-line no-mixed-spaces-and-tabs
|
||||
];
|
||||
|
||||
function wk1_fmla_to_csf(blob, o) {
|
||||
@ -592,7 +592,7 @@ var WK_ = /*#__PURE__*/(function() {
|
||||
if(!opts.qpro || length < 21) return;
|
||||
var id = blob.read_shift(1);
|
||||
blob.l += 17;
|
||||
var len = blob.read_shift(1);
|
||||
blob.l += 1; //var len = blob.read_shift(1);
|
||||
blob.l += 2;
|
||||
var nm = blob.read_shift(length - 21, 'cstr');
|
||||
return [id, nm];
|
||||
|
@ -102,7 +102,7 @@ var XLSBFillPTNames = [
|
||||
"gray125",
|
||||
"gray0625"
|
||||
];
|
||||
var rev_XLSBFillPTNames/*:EvertNumType*/
|
||||
var rev_XLSBFillPTNames/*:EvertNumType*/;
|
||||
/* TODO: gradient fill representation */
|
||||
var parse_BrtFill = parsenoop;
|
||||
function write_BrtFill(fill, o) {
|
||||
|
@ -12,7 +12,7 @@ function write_BrtMdtinfo(data) {
|
||||
write_XLWideString(data.name, o);
|
||||
return o.slice(0, o.l);
|
||||
}
|
||||
function parse_BrtMdb(data, length) {
|
||||
function parse_BrtMdb(data) {
|
||||
var out = [];
|
||||
var cnt = data.read_shift(4);
|
||||
while (cnt-- > 0)
|
||||
@ -34,7 +34,7 @@ function write_BrtBeginEsfmd(cnt, name) {
|
||||
write_XLWideString(name, o);
|
||||
return o.slice(0, o.l);
|
||||
}
|
||||
function parse_BrtBeginEsmdb(data, length) {
|
||||
function parse_BrtBeginEsmdb(data) {
|
||||
data.l += 4;
|
||||
return data.read_shift(4) != 0;
|
||||
}
|
||||
@ -49,7 +49,7 @@ function parse_xlmeta_bin(data, name, _opts) {
|
||||
var opts = _opts || {};
|
||||
var state = [];
|
||||
var pass = false;
|
||||
var esmdb = 0;
|
||||
var metatype = 2;
|
||||
recordhopper(data, function(val, R, RT) {
|
||||
switch (RT) {
|
||||
case 335:
|
||||
@ -57,11 +57,17 @@ function parse_xlmeta_bin(data, name, _opts) {
|
||||
break;
|
||||
case 51:
|
||||
val.forEach(function(r) {
|
||||
(esmdb == 1 ? out.Cell : out.Value).push({ type: out.Types[r[0] - 1].name, index: r[1] });
|
||||
if (metatype == 1)
|
||||
out.Cell.push({ type: out.Types[r[0] - 1].name, index: r[1] });
|
||||
else if (metatype == 0)
|
||||
out.Value.push({ type: out.Types[r[0] - 1].name, index: r[1] });
|
||||
});
|
||||
break;
|
||||
case 337:
|
||||
esmdb = val ? 1 : 0;
|
||||
metatype = val ? 1 : 0;
|
||||
break;
|
||||
case 338:
|
||||
metatype = 2;
|
||||
break;
|
||||
case 35:
|
||||
state.push(RT);
|
||||
|
@ -3,8 +3,8 @@ function parse_xlmeta_xml(data, name, opts) {
|
||||
if (!data)
|
||||
return out;
|
||||
var pass = false;
|
||||
var metatype = "";
|
||||
data.replace(tagregex, function(x, idx) {
|
||||
var metatype = 2;
|
||||
data.replace(tagregex, function(x) {
|
||||
var y = parsexmltag(x);
|
||||
switch (strip_ns(y[0])) {
|
||||
case "<?xml":
|
||||
@ -29,24 +29,24 @@ function parse_xlmeta_xml(data, name, opts) {
|
||||
case "</bk>":
|
||||
break;
|
||||
case "<rc":
|
||||
if (metatype == "cell")
|
||||
if (metatype == 1)
|
||||
out.Cell.push({ type: out.Types[y.t - 1].name, index: +y.v });
|
||||
else if (metatype == "value")
|
||||
else if (metatype == 0)
|
||||
out.Value.push({ type: out.Types[y.t - 1].name, index: +y.v });
|
||||
break;
|
||||
case "</rc>":
|
||||
break;
|
||||
case "<cellMetadata":
|
||||
metatype = "cell";
|
||||
metatype = 1;
|
||||
break;
|
||||
case "</cellMetadata>":
|
||||
metatype = "";
|
||||
metatype = 2;
|
||||
break;
|
||||
case "<valueMetadata":
|
||||
metatype = "value";
|
||||
metatype = 0;
|
||||
break;
|
||||
case "</valueMetadata>":
|
||||
metatype = "";
|
||||
metatype = 2;
|
||||
break;
|
||||
case "<extLst":
|
||||
case "<extLst>":
|
||||
|
@ -29,7 +29,7 @@ function sheet_insert_comments(sheet, comments/*:Array<RawComment>*/, threaded/*
|
||||
if(!threaded && cell.c[i].T) return;
|
||||
if(threaded && !cell.c[i].T) cell.c.splice(i, 1);
|
||||
}
|
||||
if(threaded && people) for(var i = 0; i < people.length; ++i) {
|
||||
if(threaded && people) for(i = 0; i < people.length; ++i) {
|
||||
if(o.a == people[i].id) { o.a = people[i].name || o.a; break; }
|
||||
}
|
||||
cell.c.push(o);
|
||||
|
@ -135,8 +135,8 @@ function write_tcmnt_xml(comments, people, opts) {
|
||||
/* [MS-XLSX] 2.1.18 */
|
||||
function parse_people_xml(data/*:string*/, opts) {
|
||||
var out = [];
|
||||
var pass = false, tidx = 0;
|
||||
data.replace(tagregex, function xml_tcmnt(x, idx) {
|
||||
var pass = false;
|
||||
data.replace(tagregex, function xml_tcmnt(x) {
|
||||
var y/*:any*/ = parsexmltag(x);
|
||||
switch(strip_ns(y[0])) {
|
||||
case '<?xml': break;
|
||||
@ -161,7 +161,7 @@ function parse_people_xml(data/*:string*/, opts) {
|
||||
});
|
||||
return out;
|
||||
}
|
||||
function write_people_xml(people, opts) {
|
||||
function write_people_xml(people/*, opts*/) {
|
||||
var o = [XML_HEADER, writextag('personList', null, {
|
||||
'xmlns': XMLNS.TCMNT,
|
||||
'xmlns:x': XMLNS_main[0]
|
||||
|
@ -106,7 +106,7 @@ function parse_ws_xml_sheetpr(sheetPr/*:string*/, s, wb/*:WBWBProps*/, idx/*:num
|
||||
if(!wb.Sheets[idx]) wb.Sheets[idx] = {};
|
||||
if(data.codeName) wb.Sheets[idx].CodeName = unescapexml(utf8read(data.codeName));
|
||||
}
|
||||
function parse_ws_xml_sheetpr2(sheetPr/*:string*/, body/*:string*/, s, wb/*:WBWBProps*/, idx/*:number*/, styles, themes) {
|
||||
function parse_ws_xml_sheetpr2(sheetPr/*:string*/, body/*:string*/, s, wb/*:WBWBProps*/, idx/*:number*/) {
|
||||
parse_ws_xml_sheetpr(sheetPr.slice(0, sheetPr.indexOf(">")), s, wb, idx);
|
||||
}
|
||||
function write_ws_xml_sheetpr(ws, wb, idx, opts, o) {
|
||||
|
@ -180,7 +180,7 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
|
||||
var state = [], tmp;
|
||||
if(DENSE != null && opts.dense == null) opts.dense = DENSE;
|
||||
var sheets = {}, sheetnames/*:Array<string>*/ = [], cursheet/*:Worksheet*/ = (opts.dense ? [] : {}), sheetname = "";
|
||||
var table = {}, cell = ({}/*:any*/), row = {};// eslint-disable-line no-unused-vars
|
||||
var cell = ({}/*:any*/), row = {};// eslint-disable-line no-unused-vars
|
||||
var dtag = xlml_parsexmltag('<Data ss:Type="String">'), didx = 0;
|
||||
var c = 0, r = 0;
|
||||
var refguess/*:Range*/ = {s: {r:2000000, c:2000000}, e: {r:0, c:0} };
|
||||
@ -305,7 +305,6 @@ function parse_xlml_xml(d, _opts)/*:Workbook*/ {
|
||||
if(Rn[1]==='/'){if((tmp=state.pop())[0]!==Rn[3]) throw new Error("Bad state: "+tmp.join("|"));}
|
||||
else if(Rn[0].slice(-2) == "/>") break;
|
||||
else {
|
||||
table = xlml_parsexmltag(Rn[0]);
|
||||
state.push([Rn[3], false]);
|
||||
cstys = []; seencol = false;
|
||||
}
|
||||
|
272
bits/76_xls.js
272
bits/76_xls.js
@ -181,8 +181,6 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
var merges/*:Array<Range>*/ = [];
|
||||
var objects = [];
|
||||
var colinfo/*:Array<ColInfo>*/ = [], rowinfo/*:Array<RowInfo>*/ = [];
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var defwidth = 0, defheight = 0; // twips / MDW respectively
|
||||
var seencol = false;
|
||||
var supbooks = ([]/*:any*/); // 1-indexed, will hold extern names
|
||||
supbooks.SheetNames = opts.snames;
|
||||
@ -227,7 +225,6 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
/*:: val = (val:any); */
|
||||
if(file_depth == 0 && [0x0009, 0x0209, 0x0409, 0x0809].indexOf(last_RT) === -1 /* 'BOF' */) continue;
|
||||
switch(RecordType) {
|
||||
/* Workbook Options */
|
||||
case 0x0022 /* Date1904 */:
|
||||
/*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */
|
||||
wb.opts.Date1904 = Workbook.WBProps.date1904 = val; break;
|
||||
@ -240,7 +237,6 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
if(!val.valid) throw new Error("Password is incorrect");
|
||||
break;
|
||||
case 0x005c /* WriteAccess */: opts.lastuser = val; break;
|
||||
case 0x005b /* FileSharing */: break; //TODO
|
||||
case 0x0042 /* CodePage */:
|
||||
var cpval = Number(val);
|
||||
/* overrides based on test cases */
|
||||
@ -254,10 +250,6 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
break;
|
||||
case 0x013d /* RRTabId */: opts.rrtabid = val; break;
|
||||
case 0x0019 /* WinProtect */: opts.winlocked = val; break;
|
||||
case 0x0060 /* Template */: break; // TODO
|
||||
case 0x00da /* BookBool */: break; // TODO
|
||||
case 0x0160 /* UsesELFs */: break;
|
||||
case 0x089a /* MTRSettings */: break;
|
||||
case 0x01b7 /* RefreshAll */: wb.opts["RefreshAll"] = val; break;
|
||||
case 0x000c /* CalcCount */: wb.opts["CalcCount"] = val; break;
|
||||
case 0x0010 /* CalcDelta */: wb.opts["CalcDelta"] = val; break;
|
||||
@ -266,7 +258,6 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
case 0x000e /* CalcPrecision */: wb.opts["CalcPrecision"] = val; break;
|
||||
case 0x005f /* CalcSaveRecalc */: wb.opts["CalcSaveRecalc"] = val; break;
|
||||
case 0x000f /* CalcRefMode */: opts.CalcRefMode = val; break; // TODO: implement R1C1
|
||||
case 0x005e /* Uncalced */: break;
|
||||
case 0x08a3 /* ForceFullCalculation */: wb.opts.FullCalc = val; break;
|
||||
case 0x0081 /* WsBool */:
|
||||
if(val.fDialog) out["!type"] = "dialog";
|
||||
@ -275,11 +266,6 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
break; // TODO
|
||||
case 0x00e0 /* XF */:
|
||||
XFs.push(val); break;
|
||||
case 0x00ff /* ExtSST */: break; // TODO
|
||||
case 0x0863 /* BookExt */: break; // TODO
|
||||
case 0x08a6 /* RichTextStream */: break;
|
||||
case 0x00e9 /* BkHim */: break;
|
||||
|
||||
case 0x01ae /* SupBook */:
|
||||
supbooks.push([val]);
|
||||
supbooks[supbooks.length-1].XTI = [];
|
||||
@ -287,7 +273,6 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
case 0x0023: case 0x0223 /* ExternName */:
|
||||
supbooks[supbooks.length-1].push(val);
|
||||
break;
|
||||
case 0x000b: case 0x020b /* Index */: break; // TODO
|
||||
case 0x0018: case 0x0218 /* Lbl */:
|
||||
last_lbl = ({
|
||||
Name: val.Name,
|
||||
@ -310,11 +295,8 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
if(opts.biff < 8) break;
|
||||
if(last_lbl != null) last_lbl.Comment = val[1];
|
||||
break;
|
||||
|
||||
case 0x0012 /* Protect */: out["!protect"] = val; break; /* for sheet or book */
|
||||
case 0x0013 /* Password */: if(val !== 0 && opts.WTF) console.error("Password verifier: " + val); break;
|
||||
case 0x01af /* Prot4Rev */: case 0x01bc /* Prot4RevPass */: break; /*TODO: Revision Control*/
|
||||
|
||||
case 0x0085 /* BoundSheet8 */: {
|
||||
Directory[val.pos] = val;
|
||||
opts.snames.push(val.name);
|
||||
@ -380,11 +362,9 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
objects = [];
|
||||
opts.arrayf = arrayf = [];
|
||||
colinfo = []; rowinfo = [];
|
||||
defwidth = defheight = 0;
|
||||
seencol = false;
|
||||
wsprops = {Hidden:(Directory[s]||{hs:0}).hs, name:cur_sheet };
|
||||
} break;
|
||||
|
||||
case 0x0203 /* Number */: case 0x0003 /* BIFF2NUM */: case 0x0002 /* BIFF2INT */: {
|
||||
if(out["!type"] == "chart") if(options.dense ? (out[val.r]||[])[val.c]: out[encode_cell({c:val.c, r:val.r})]) ++val.c;
|
||||
temp_val = ({ixfe: val.ixfe, XF: XFs[val.ixfe]||{}, v:val.val, t:'n'}/*:any*/);
|
||||
@ -538,8 +518,6 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
if(cc && cc.l) cc.l.Tooltip = val[1];
|
||||
}
|
||||
} break;
|
||||
|
||||
/* Comments */
|
||||
case 0x001c /* Note */: {
|
||||
if(opts.biff <= 5 && opts.biff >= 2) break; /* TODO: BIFF5 */
|
||||
cc = options.dense ? (out[val[0].r]||[])[val[0].c] : out[encode_cell(val[0])];
|
||||
@ -560,13 +538,7 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
cmnt = {a:val[1],t:noteobj.TxO.t};
|
||||
cc.c.push(cmnt);
|
||||
} break;
|
||||
|
||||
case 0x105c /* ClrtClient */: break;
|
||||
case 0x087d /* XFExt */: update_xfext(XFs[val.ixfe], val.ext); break;
|
||||
|
||||
case 0x0055 /* DefColWidth */: defwidth = val; break;
|
||||
case 0x0225 /* DefaultRowHeight */: defheight = val[1]; break; // TODO: flags
|
||||
|
||||
case 0x007d /* ColInfo */: {
|
||||
if(!opts.cellStyles) break;
|
||||
while(val.e >= val.s) {
|
||||
@ -584,7 +556,6 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
rowobj.hpt = val.hpt; rowobj.hpx = pt2px(val.hpt);
|
||||
}
|
||||
} break;
|
||||
|
||||
case 0x0026 /* LeftMargin */:
|
||||
case 0x0027 /* RightMargin */:
|
||||
case 0x0028 /* TopMargin */:
|
||||
@ -592,161 +563,126 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
if(!out['!margins']) default_margins(out['!margins'] = {});
|
||||
out['!margins'][({0x26: "left", 0x27:"right", 0x28:"top", 0x29:"bottom"})[RecordType]] = val;
|
||||
break;
|
||||
|
||||
case 0x001d /* Selection */: break;
|
||||
|
||||
case 0x00a1 /* Setup */: // TODO
|
||||
if(!out['!margins']) default_margins(out['!margins'] = {});
|
||||
out['!margins'].header = val.header;
|
||||
out['!margins'].footer = val.footer;
|
||||
break;
|
||||
|
||||
case 0x023e /* Window2 */: // TODO
|
||||
// $FlowIgnore
|
||||
if(val.RTL) Workbook.Views[0].RTL = true;
|
||||
break;
|
||||
|
||||
case 0x0014 /* Header */: // TODO
|
||||
case 0x0015 /* Footer */: // TODO
|
||||
case 0x0083 /* HCenter */: // TODO
|
||||
case 0x0084 /* VCenter */: // TODO
|
||||
case 0x004d /* Pls */: // TODO
|
||||
case 0x00ab /* GCW */:
|
||||
case 0x0094 /* LHRecord */:
|
||||
case 0x00d7 /* DBCell */: // TODO
|
||||
case 0x01c2 /* EntExU2 */: // TODO
|
||||
case 0x00b0 /* SxView */: // TODO
|
||||
case 0x00b1 /* Sxvd */: // TODO
|
||||
case 0x00b2 /* SXVI */: // TODO
|
||||
case 0x0100 /* SXVDEx */: // TODO
|
||||
case 0x00b4 /* SxIvd */: // TODO
|
||||
case 0x00cd /* SXString */: // TODO
|
||||
case 0x0097 /* Sync */:
|
||||
case 0x0087 /* Addin */:
|
||||
case 0x00c5 /* SXDI */: // TODO
|
||||
case 0x00b5 /* SXLI */: // TODO
|
||||
case 0x00f1 /* SXEx */: // TODO
|
||||
case 0x0802 /* QsiSXTag */: // TODO
|
||||
case 0x0868 /* Feat */:
|
||||
case 0x0867 /* FeatHdr */: case 0x0871 /* FeatHdr11 */:
|
||||
case 0x0872 /* Feature11 */: case 0x0878 /* Feature12 */: case 0x0877 /* List12 */: break;
|
||||
case 0x008c /* Country */: country = val; break;
|
||||
case 0x01c1 /* RecalcId */:
|
||||
case 0x0099 /* DxGCol */: // TODO: htmlify
|
||||
case 0x1060 /* Fbi */: case 0x1068 /* Fbi2 */: case 0x1066 /* GelFrame */:
|
||||
case 0x0031 /* Font */: // TODO
|
||||
case 0x087c /* XFCRC */: // TODO
|
||||
case 0x0293 /* Style */: // TODO
|
||||
case 0x0892 /* StyleExt */: break; // TODO
|
||||
case 0x0092 /* Palette */: palette = val; break;
|
||||
case 0x0896 /* Theme */: themes = val; break;
|
||||
/* Protection */
|
||||
case 0x00dd /* ScenarioProtect */:
|
||||
case 0x0063 /* ObjProtect */: break;
|
||||
|
||||
/* Conditional Formatting */
|
||||
case 0x0879 /* CondFmt12 */:
|
||||
|
||||
/* Table */
|
||||
case 0x0236 /* Table */: // TODO
|
||||
case 0x088e /* TableStyles */: // TODO
|
||||
case 0x088f /* TableStyle */: // TODO
|
||||
case 0x0890 /* TableStyleElement */: // TODO
|
||||
|
||||
/* PivotTable */
|
||||
case 0x00d5 /* SXStreamID */: // TODO
|
||||
case 0x00e3 /* SXVS */: // TODO
|
||||
case 0x0051 /* DConRef */: // TODO
|
||||
case 0x0864 /* SXAddl */: // TODO
|
||||
case 0x01b5 /* DConBin */: // TODO
|
||||
case 0x0052 /* DConName */: // TODO
|
||||
case 0x00b6 /* SXPI */: // TODO
|
||||
case 0x00fb /* SxFormat */: // TODO
|
||||
case 0x00f7 /* SxSelect */: // TODO
|
||||
case 0x00f0 /* SxRule */: // TODO
|
||||
case 0x00f2 /* SxFilt */: // TODO
|
||||
case 0x00f5 /* SxItm */: // TODO
|
||||
case 0x00f4 /* SxDXF */: // TODO
|
||||
|
||||
/* Scenario Manager */
|
||||
case 0x00ae /* ScenMan */:
|
||||
|
||||
/* Data Consolidation */
|
||||
case 0x0050 /* DCon */:
|
||||
|
||||
/* Watched Cell */
|
||||
case 0x086c /* CellWatch */:
|
||||
|
||||
/* Print Settings */
|
||||
case 0x002a /* PrintRowCol */:
|
||||
case 0x002b /* PrintGrid */:
|
||||
case 0x0033 /* PrintSize */:
|
||||
|
||||
case 0x0059 /* XCT */:
|
||||
case 0x005a /* CRN */:
|
||||
|
||||
case 0x00a0 /* Scl */: {
|
||||
//console.log("Zoom Level:", val[0]/val[1],val);
|
||||
}
|
||||
case 0x0862 /* SheetExt */: {
|
||||
/* empty */
|
||||
}
|
||||
|
||||
/* VBA */
|
||||
case 0x01bd /* ObNoMacros */: {
|
||||
/* empty */
|
||||
}
|
||||
case 0x00d3 /* ObProj */: {
|
||||
/* empty */
|
||||
}
|
||||
case 0x008c /* Country */: country = val; break;
|
||||
case 0x01ba /* CodeName */: {
|
||||
/*:: if(!Workbook.WBProps) Workbook.WBProps = {}; */
|
||||
if(!cur_sheet) Workbook.WBProps.CodeName = val || "ThisWorkbook";
|
||||
else wsprops.CodeName = val || wsprops.name;
|
||||
}
|
||||
case 0x0897 /* GUIDTypeLib */: {
|
||||
/* empty */
|
||||
}
|
||||
|
||||
case 0x080b /* WOpt */: // TODO: WTF?
|
||||
} break;
|
||||
case 0x0055 /* DefColWidth */:
|
||||
case 0x0225 /* DefaultRowHeight */:
|
||||
case 0x005e /* Uncalced */:
|
||||
case 0x01af /* Prot4Rev */: case 0x01bc /* Prot4RevPass */: /*TODO: Revision Control*/
|
||||
case 0x005b /* FileSharing */:
|
||||
case 0x00ff /* ExtSST */:
|
||||
case 0x0863 /* BookExt */:
|
||||
case 0x08a6 /* RichTextStream */:
|
||||
case 0x00e9 /* BkHim */:
|
||||
case 0x0060 /* Template */:
|
||||
case 0x00da /* BookBool */:
|
||||
case 0x0160 /* UsesELFs */:
|
||||
case 0x089a /* MTRSettings */:
|
||||
case 0x000b: case 0x020b /* Index */:
|
||||
case 0x105c /* ClrtClient */:
|
||||
case 0x001d /* Selection */:
|
||||
case 0x0014 /* Header */:
|
||||
case 0x0015 /* Footer */:
|
||||
case 0x0083 /* HCenter */:
|
||||
case 0x0084 /* VCenter */:
|
||||
case 0x004d /* Pls */:
|
||||
case 0x00ab /* GCW */:
|
||||
case 0x0094 /* LHRecord */:
|
||||
case 0x00d7 /* DBCell */:
|
||||
case 0x01c2 /* EntExU2 */:
|
||||
case 0x00b0 /* SxView */:
|
||||
case 0x00b1 /* Sxvd */:
|
||||
case 0x00b2 /* SXVI */:
|
||||
case 0x0100 /* SXVDEx */:
|
||||
case 0x00b4 /* SxIvd */:
|
||||
case 0x00cd /* SXString */:
|
||||
case 0x0097 /* Sync */:
|
||||
case 0x0087 /* Addin */:
|
||||
case 0x00c5 /* SXDI */:
|
||||
case 0x00b5 /* SXLI */:
|
||||
case 0x00f1 /* SXEx */:
|
||||
case 0x0802 /* QsiSXTag */:
|
||||
case 0x0868 /* Feat */:
|
||||
case 0x0867 /* FeatHdr */: case 0x0871 /* FeatHdr11 */:
|
||||
case 0x0872 /* Feature11 */: case 0x0878 /* Feature12 */: case 0x0877 /* List12 */:
|
||||
case 0x01c1 /* RecalcId */:
|
||||
case 0x0099 /* DxGCol */:
|
||||
case 0x1060 /* Fbi */: case 0x1068 /* Fbi2 */: case 0x1066 /* GelFrame */:
|
||||
case 0x0031 /* Font */:
|
||||
case 0x087c /* XFCRC */:
|
||||
case 0x0293 /* Style */:
|
||||
case 0x0892 /* StyleExt */:
|
||||
case 0x00dd /* ScenarioProtect */:
|
||||
case 0x0063 /* ObjProtect */:
|
||||
case 0x0879 /* CondFmt12 */:
|
||||
case 0x0236 /* Table */:
|
||||
case 0x088e /* TableStyles */:
|
||||
case 0x088f /* TableStyle */:
|
||||
case 0x0890 /* TableStyleElement */:
|
||||
case 0x00d5 /* SXStreamID */:
|
||||
case 0x00e3 /* SXVS */:
|
||||
case 0x0051 /* DConRef */:
|
||||
case 0x0864 /* SXAddl */:
|
||||
case 0x01b5 /* DConBin */:
|
||||
case 0x0052 /* DConName */:
|
||||
case 0x00b6 /* SXPI */:
|
||||
case 0x00fb /* SxFormat */:
|
||||
case 0x00f7 /* SxSelect */:
|
||||
case 0x00f0 /* SxRule */:
|
||||
case 0x00f2 /* SxFilt */:
|
||||
case 0x00f5 /* SxItm */:
|
||||
case 0x00f4 /* SxDXF */:
|
||||
case 0x00ae /* ScenMan */:
|
||||
case 0x0050 /* DCon */:
|
||||
case 0x086c /* CellWatch */:
|
||||
case 0x002a /* PrintRowCol */:
|
||||
case 0x002b /* PrintGrid */:
|
||||
case 0x0033 /* PrintSize */:
|
||||
case 0x0059 /* XCT */:
|
||||
case 0x005a /* CRN */:
|
||||
case 0x00a0 /* Scl */:
|
||||
case 0x0862 /* SheetExt */:
|
||||
case 0x01bd /* ObNoMacros */:
|
||||
case 0x00d3 /* ObProj */:
|
||||
case 0x0897 /* GUIDTypeLib */:
|
||||
case 0x080b /* WOpt */:
|
||||
case 0x00ef /* PhoneticInfo */:
|
||||
|
||||
case 0x00de /* OleObjectSize */:
|
||||
|
||||
/* Differential Formatting */
|
||||
case 0x088d /* DXF */:
|
||||
|
||||
/* Data Validation */
|
||||
case 0x01be /* Dv */: case 0x01b2 /* DVal */:
|
||||
|
||||
/* Data Series */
|
||||
case 0x1051 /* BRAI */: case 0x1003 /* Series */: case 0x100d /* SeriesText */: break;
|
||||
|
||||
/* Data Connection */
|
||||
case 0x1051 /* BRAI */: case 0x1003 /* Series */: case 0x100d /* SeriesText */:
|
||||
case 0x0876 /* DConn */:
|
||||
case 0x00dc /* DbOrParamQry */:
|
||||
case 0x0803 /* DBQueryExt */:
|
||||
|
||||
case 0x080a /* OleDbConn */:
|
||||
case 0x0804 /* ExtString */:
|
||||
|
||||
/* Formatting */
|
||||
case 0x104e /* IFmtRecord */:
|
||||
case 0x01b0 /* CondFmt */: case 0x01b1 /* CF */: case 0x087a /* CF12 */: case 0x087b /* CFEx */:
|
||||
|
||||
/* Explicitly Ignored */
|
||||
case 0x01c0 /* Excel9File */:
|
||||
case 0x1001 /* Units */:
|
||||
case 0x00e1 /* InterfaceHdr' */: case 0x00c1 /* Mms */: case 0x00e2 /* InterfaceEnd */: case 0x0161 /* DSF */:
|
||||
case 0x009c /* BuiltInFnGroupCount */: /* 2.4.30 0x0E or 0x10 but excel 2011 generates 0x11? */ break;
|
||||
/* View Stuff */
|
||||
case 0x003d /* Window1 */: case 0x008d /* HideObj */: case 0x0082 /* GridSet */: case 0x0080 /* Guts */:
|
||||
case 0x01a9 /* UserBView */: case 0x01aa /* UserSViewBegin */: case 0x01aa /* UserSViewEnd */:
|
||||
case 0x01a9 /* UserBView */: case 0x01aa /* UserSViewBegin */: case 0x01ab /* UserSViewEnd */:
|
||||
case 0x0041 /* Pane */:
|
||||
/* Chart */
|
||||
case 0x1063 /* Dat */:
|
||||
case 0x1033 /* Begin */: case 0x1033 /* End */:
|
||||
case 0x0852 /* StartBlock */: case 0x0853 /* EndBlock */: break;
|
||||
case 0x1033 /* Begin */: case 0x1034 /* End */:
|
||||
case 0x0852 /* StartBlock */: case 0x0853 /* EndBlock */:
|
||||
case 0x1032 /* Frame */: case 0x101a /* Area */:
|
||||
case 0x101d /* Axis */: case 0x1021 /* AxisLine */: case 0x101e /* Tick */:
|
||||
case 0x1046 /* AxesUsed */:
|
||||
@ -767,69 +703,41 @@ function parse_workbook(blob, options/*:ParseOpts*/)/*:Workbook*/ {
|
||||
case 0x1050 /* AlRuns */: case 0x1027 /* ObjectLink */:
|
||||
case 0x1065 /* SIIndex */:
|
||||
case 0x100c /* AttachedLabel */: case 0x0857 /* YMult */:
|
||||
|
||||
/* Chart Group */
|
||||
case 0x1018 /* Line */: case 0x1017 /* Bar */:
|
||||
case 0x103f /* Surf */:
|
||||
|
||||
/* Axis Group */
|
||||
case 0x1041 /* AxisParent */:
|
||||
case 0x104f /* Pos */:
|
||||
case 0x101f /* ValueRange */:
|
||||
|
||||
/* Pivot Chart */
|
||||
case 0x0810 /* SXViewEx9 */: // TODO
|
||||
case 0x0810 /* SXViewEx9 */:
|
||||
case 0x0858 /* SXViewLink */:
|
||||
case 0x0859 /* PivotChartBits */:
|
||||
case 0x1048 /* SBaseRef */:
|
||||
case 0x08a5 /* TextPropsStream */:
|
||||
|
||||
/* Chart Misc */
|
||||
case 0x08c9 /* LnExt */:
|
||||
case 0x08ca /* MkrExt */:
|
||||
case 0x08cb /* CrtCoopt */:
|
||||
|
||||
/* Query Table */
|
||||
case 0x01ad /* Qsi */: case 0x0807 /* Qsif */: case 0x0806 /* Qsir */: case 0x0802 /* QsiSXTag */:
|
||||
case 0x01ad /* Qsi */: case 0x0807 /* Qsif */: case 0x0806 /* Qsir */:
|
||||
case 0x0805 /* TxtQry */:
|
||||
|
||||
/* Filter */
|
||||
case 0x009b /* FilterMode */:
|
||||
case 0x009e /* AutoFilter */: case 0x009d /* AutoFilterInfo */:
|
||||
case 0x087e /* AutoFilter12 */:
|
||||
case 0x0874 /* DropDownObjIds */:
|
||||
case 0x0090 /* Sort */:
|
||||
case 0x0895 /* SortData */:
|
||||
|
||||
/* Drawing */
|
||||
case 0x08a4 /* ShapePropsStream */:
|
||||
case 0x00ec /* MsoDrawing */: case 0x00eb /* MsoDrawingGroup*/: case 0x00ed /* MsoDrawingSelection */:
|
||||
/* Pub Stuff */
|
||||
case 0x0801 /* WebPub */: case 0x08c0 /* AutoWebPub */:
|
||||
|
||||
/* Print Stuff */
|
||||
case 0x089c /* HeaderFooter */: case 0x0866 /* HFPicture */: case 0x088b /* PLV */:
|
||||
case 0x001b /* HorizontalPageBreaks */: case 0x001a /* VerticalPageBreaks */:
|
||||
/* Behavioral */
|
||||
case 0x0040 /* Backup */: case 0x089b /* CompressPictures */: case 0x088c /* Compat12 */:
|
||||
|
||||
/* Should not Happen */
|
||||
case 0x003c /* 'Continue' */: case 0x087f /* 'ContinueFrt12' */:
|
||||
|
||||
/* Future Records */
|
||||
case 0x085a /* FrtFontList */: case 0x0851 /* 'FrtWrapper' */:
|
||||
|
||||
/* BIFF5 records */
|
||||
case 0x00ea /* TabIdConf */: case 0x103e /* Radar */: case 0x1040 /* RadarArea */: case 0x103d /* DropBar */: case 'Intl': case 'CoordList': case 'SerAuxErrBar':
|
||||
|
||||
/* BIFF2-4 records */
|
||||
case 0x0045 /* BIFF2FONTCLR */: case 0x001f /* BIFF2FMTCNT */: case 0x0032 /* BIFF2FONTXTRA */:
|
||||
case 0x0043 /* BIFF2XF */: case 0x0243 /* BIFF3XF */: case 0x0443 /* BIFF4XF */:
|
||||
case 0x0044 /* BIFF2XFINDEX */:
|
||||
case 0x0056 /* BIFF4FMTCNT */: case 0x0008 /* BIFF2ROW */: case 0x003e /* BIFF2WINDOW2 */:
|
||||
|
||||
/* Miscellaneous */
|
||||
case 0x00af /* SCENARIO */: case 0x01b5 /* DConBin */: case 0x103c /* PicF */: case 0x086a /* DataLabExt */:
|
||||
case 0x00af /* SCENARIO */: case 0x103c /* PicF */: case 0x086a /* DataLabExt */:
|
||||
case 0x01b9 /* Lel */: case 0x1061 /* BopPop */: case 0x1067 /* BopPopCustom */: case 0x0813 /* RealTimeData */:
|
||||
case 0x0095 /* LHNGraph */: case 0x009a /* FnGroupName */: case 0x00c2 /* AddMenu */: case 0x0098 /* LPr */:
|
||||
case 0x08c1 /* ListObj */: case 0x08c2 /* ListField */:
|
||||
|
@ -163,7 +163,7 @@ function write_ws_biff8_hlinks(ba/*:BufArray*/, ws) {
|
||||
delete ws['!links'];
|
||||
}
|
||||
|
||||
function write_ws_cols_biff8(ba, cols, ws) {
|
||||
function write_ws_cols_biff8(ba, cols) {
|
||||
if(!cols) return;
|
||||
var cnt = 0;
|
||||
cols.forEach(function(col, idx) {
|
||||
@ -236,7 +236,7 @@ function write_ws_biff8(idx/*:number*/, opts, wb/*:Workbook*/) {
|
||||
write_biff_rec(ba, 0x0083 /* HCenter */, writebool(false));
|
||||
write_biff_rec(ba, 0x0084 /* VCenter */, writebool(false));
|
||||
/* ... */
|
||||
if(b8) write_ws_cols_biff8(ba, ws["!cols"], ws);
|
||||
if(b8) write_ws_cols_biff8(ba, ws["!cols"]);
|
||||
/* ... */
|
||||
write_biff_rec(ba, 0x200, write_Dimensions(range, opts));
|
||||
/* ... */
|
||||
@ -387,7 +387,7 @@ function write_biff_buf(wb/*:Workbook*/, opts/*:WriteOpts*/) {
|
||||
if(!ws || !ws["!ref"]) continue;
|
||||
var range = decode_range(ws["!ref"]);
|
||||
if(range.e.c > 255) { // note: 255 is IV
|
||||
if(typeof console != "undefined" && console.error) console.error("Worksheet '" + wb.SheetNames[i] + "' extends beyond column IV (255). Data may be lost.");
|
||||
if(typeof console != "undefined" && console.error) console.error("Worksheet '" + wb.SheetNames[i] + "' extends beyond column IV (255). Data may be lost.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,43 +60,6 @@ function parse_varint49(buf, ptr) {
|
||||
ptr[0] = l;
|
||||
return usz;
|
||||
}
|
||||
function write_varint49(v) {
|
||||
var usz = new Uint8Array(7);
|
||||
usz[0] = v & 127;
|
||||
var L = 1;
|
||||
sz:
|
||||
if (v > 127) {
|
||||
usz[L - 1] |= 128;
|
||||
usz[L] = v >> 7 & 127;
|
||||
++L;
|
||||
if (v <= 16383)
|
||||
break sz;
|
||||
usz[L - 1] |= 128;
|
||||
usz[L] = v >> 14 & 127;
|
||||
++L;
|
||||
if (v <= 2097151)
|
||||
break sz;
|
||||
usz[L - 1] |= 128;
|
||||
usz[L] = v >> 21 & 127;
|
||||
++L;
|
||||
if (v <= 268435455)
|
||||
break sz;
|
||||
usz[L - 1] |= 128;
|
||||
usz[L] = v / 256 >>> 21 & 127;
|
||||
++L;
|
||||
if (v <= 34359738367)
|
||||
break sz;
|
||||
usz[L - 1] |= 128;
|
||||
usz[L] = v / 65536 >>> 21 & 127;
|
||||
++L;
|
||||
if (v <= 4398046511103)
|
||||
break sz;
|
||||
usz[L - 1] |= 128;
|
||||
usz[L] = v / 16777216 >>> 21 & 127;
|
||||
++L;
|
||||
}
|
||||
return usz.slice(0, L);
|
||||
}
|
||||
function varint_to_i32(buf) {
|
||||
var l = 0, i32 = buf[l] & 127;
|
||||
varint:
|
||||
@ -162,16 +125,6 @@ function parse_shallow(buf) {
|
||||
}
|
||||
return out;
|
||||
}
|
||||
function write_shallow(proto) {
|
||||
var out = [];
|
||||
proto.forEach(function(field, idx) {
|
||||
field.forEach(function(item) {
|
||||
out.push(write_varint49(idx * 8 + item.type));
|
||||
out.push(item.data);
|
||||
});
|
||||
});
|
||||
return u8concat(out);
|
||||
}
|
||||
function mappa(data, cb) {
|
||||
if (!data)
|
||||
return [];
|
||||
|
@ -13,7 +13,7 @@ function safe_parse_wbrels(wbrels, sheets) {
|
||||
return !wbrels || wbrels.length === 0 ? null : wbrels;
|
||||
}
|
||||
|
||||
function safe_parse_sheet(zip, path/*:string*/, relsPath/*:string*/, sheet, idx/*:number*/, sheetRels, sheets, stype/*:string*/, opts, wb, themes, styles, people) {
|
||||
function safe_parse_sheet(zip, path/*:string*/, relsPath/*:string*/, sheet, idx/*:number*/, sheetRels, sheets, stype/*:string*/, opts, wb, themes, styles) {
|
||||
try {
|
||||
sheetRels[sheet]=parse_rels(getzipstr(zip, relsPath, true), path);
|
||||
var data = getzipdata(zip, path);
|
||||
@ -36,7 +36,7 @@ function safe_parse_sheet(zip, path/*:string*/, relsPath/*:string*/, sheet, idx/
|
||||
sheets[sheet] = _ws;
|
||||
|
||||
/* scan rels for comments and threaded comments */
|
||||
var tcomments = [], tauthors = [];
|
||||
var tcomments = [];
|
||||
if(sheetRels && sheetRels[sheet]) keys(sheetRels[sheet]).forEach(function(n) {
|
||||
var dfile = "";
|
||||
if(sheetRels[sheet][n].Type == RELS.CMNT) {
|
||||
|
@ -79,8 +79,9 @@ function write_zip_xlsxb(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
||||
if(ws) {
|
||||
var comments = ws['!comments'];
|
||||
var need_vml = false;
|
||||
var cf = "";
|
||||
if(comments && comments.length > 0) {
|
||||
var cf = "xl/comments" + rId + "." + wbext;
|
||||
cf = "xl/comments" + rId + "." + wbext;
|
||||
zip_add_file(zip, cf, write_cmnt(comments, cf, opts));
|
||||
ct.comments.push(cf);
|
||||
add_rels(wsrels, -1, "../comments" + rId + "." + wbext, RELS.CMNT);
|
||||
@ -216,6 +217,7 @@ function write_zip_xlsx(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
||||
if(ws) {
|
||||
var comments = ws['!comments'];
|
||||
var need_vml = false;
|
||||
var cf = "";
|
||||
if(comments && comments.length > 0) {
|
||||
var needtc = false;
|
||||
comments.forEach(function(carr) {
|
||||
@ -228,7 +230,7 @@ function write_zip_xlsx(wb/*:Workbook*/, opts/*:WriteOpts*/)/*:ZIP*/ {
|
||||
add_rels(wsrels, -1, "../threadedComments/threadedComment" + rId + "." + wbext, RELS.TCMNT);
|
||||
}
|
||||
|
||||
var cf = "xl/comments" + rId + "." + wbext;
|
||||
cf = "xl/comments" + rId + "." + wbext;
|
||||
zip_add_file(zip, cf, write_comments_xml(comments, opts));
|
||||
ct.comments.push(cf);
|
||||
add_rels(wsrels, -1, "../comments" + rId + "." + wbext, RELS.CMNT);
|
||||
|
13
demos/vue/modify/index.html
Normal file
13
demos/vue/modify/index.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite App</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
29
dist/xlsx.core.min.js
generated
vendored
29
dist/xlsx.core.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/xlsx.core.min.map
generated
vendored
2
dist/xlsx.core.min.map
generated
vendored
File diff suppressed because one or more lines are too long
6212
dist/xlsx.extendscript.js
generated
vendored
6212
dist/xlsx.extendscript.js
generated
vendored
File diff suppressed because it is too large
Load Diff
31
dist/xlsx.full.min.js
generated
vendored
31
dist/xlsx.full.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/xlsx.full.min.map
generated
vendored
2
dist/xlsx.full.min.map
generated
vendored
File diff suppressed because one or more lines are too long
16
dist/xlsx.mini.min.js
generated
vendored
16
dist/xlsx.mini.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/xlsx.mini.min.map
generated
vendored
2
dist/xlsx.mini.min.map
generated
vendored
File diff suppressed because one or more lines are too long
@ -35,6 +35,7 @@ The [`demos` directory](demos/) includes sample projects for:
|
||||
- [`canvas-datagrid`](demos/datagrid/)
|
||||
- [`x-spreadsheet`](demos/xspreadsheet/)
|
||||
- [`react-data-grid`](demos/react/modify/)
|
||||
- [`vue3-table-light`](demos/vue/modify/)
|
||||
- [`Swift JSC and other engines`](demos/altjs/)
|
||||
- [`"serverless" functions`](demos/function/)
|
||||
- [`internet explorer`](demos/oldie/)
|
||||
|
@ -80,6 +80,14 @@ export default function App() {
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Previewing data in a VueJS data grid</b> (click to show)</summary>
|
||||
|
||||
[`vue3-table-lite`](https://github.com/linmasahiro/vue3-table-lite) is a simple
|
||||
VueJS 3 data table. It is featured [in the VueJS demo](/demos/vue/modify/).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Populating a database (SQL or no-SQL)</b> (click to show)</summary>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
||||
/* vim: set ts=2: */
|
||||
/*exported XLSX */
|
||||
/*global process:false, Buffer:false, ArrayBuffer:false, Deno:false */
|
||||
/*global process:false, Buffer:false, ArrayBuffer:false, DataView:false, Deno:false */
|
||||
var XLSX = {};
|
||||
|
@ -3,8 +3,8 @@ function parse_xlmeta_xml(data, name, opts) {
|
||||
if (!data)
|
||||
return out;
|
||||
var pass = false;
|
||||
var metatype = "";
|
||||
data.replace(tagregex, function(x, idx) {
|
||||
var metatype = 2;
|
||||
data.replace(tagregex, function(x) {
|
||||
var y = parsexmltag(x);
|
||||
switch (strip_ns(y[0])) {
|
||||
case "<?xml":
|
||||
@ -29,24 +29,24 @@ function parse_xlmeta_xml(data, name, opts) {
|
||||
case "</bk>":
|
||||
break;
|
||||
case "<rc":
|
||||
if (metatype == "cell")
|
||||
if (metatype == 1)
|
||||
out.Cell.push({ type: out.Types[y.t - 1].name, index: +y.v });
|
||||
else if (metatype == "value")
|
||||
else if (metatype == 0)
|
||||
out.Value.push({ type: out.Types[y.t - 1].name, index: +y.v });
|
||||
break;
|
||||
case "</rc>":
|
||||
break;
|
||||
case "<cellMetadata":
|
||||
metatype = "cell";
|
||||
metatype = 1;
|
||||
break;
|
||||
case "</cellMetadata>":
|
||||
metatype = "";
|
||||
metatype = 2;
|
||||
break;
|
||||
case "<valueMetadata":
|
||||
metatype = "value";
|
||||
metatype = 0;
|
||||
break;
|
||||
case "</valueMetadata>":
|
||||
metatype = "";
|
||||
metatype = 2;
|
||||
break;
|
||||
case "<extLst":
|
||||
case "<extLst>":
|
||||
|
@ -563,6 +563,7 @@ The [`demos` directory](demos/) includes sample projects for:
|
||||
- [`canvas-datagrid`](demos/datagrid/)
|
||||
- [`x-spreadsheet`](demos/xspreadsheet/)
|
||||
- [`react-data-grid`](demos/react/modify/)
|
||||
- [`vue3-table-light`](demos/vue/modify/)
|
||||
- [`Swift JSC and other engines`](demos/altjs/)
|
||||
- [`"serverless" functions`](demos/function/)
|
||||
- [`internet explorer`](demos/oldie/)
|
||||
@ -1721,6 +1722,11 @@ export default function App() {
|
||||
|
||||
|
||||
|
||||
[`vue3-table-lite`](https://github.com/linmasahiro/vue3-table-lite) is a simple
|
||||
VueJS 3 data table. It is featured [in the VueJS demo](/demos/vue/modify/).
|
||||
|
||||
|
||||
|
||||
The [`database` demo](/demos/database/) includes examples of working with
|
||||
databases and query results.
|
||||
|
||||
|
@ -12,7 +12,7 @@ function write_BrtMdtinfo(data) {
|
||||
write_XLWideString(data.name, o);
|
||||
return o.slice(0, o.l);
|
||||
}
|
||||
function parse_BrtMdb(data, length) {
|
||||
function parse_BrtMdb(data) {
|
||||
var out = [];
|
||||
var cnt = data.read_shift(4);
|
||||
while (cnt-- > 0)
|
||||
@ -34,7 +34,7 @@ function write_BrtBeginEsfmd(cnt, name) {
|
||||
write_XLWideString(name, o);
|
||||
return o.slice(0, o.l);
|
||||
}
|
||||
function parse_BrtBeginEsmdb(data, length) {
|
||||
function parse_BrtBeginEsmdb(data) {
|
||||
data.l += 4;
|
||||
return data.read_shift(4) != 0;
|
||||
}
|
||||
@ -49,7 +49,7 @@ function parse_xlmeta_bin(data, name, _opts) {
|
||||
var opts = _opts || {};
|
||||
var state = [];
|
||||
var pass = false;
|
||||
var esmdb = 0;
|
||||
var metatype = 2;
|
||||
recordhopper(data, function(val, R, RT) {
|
||||
switch (RT) {
|
||||
case 335:
|
||||
@ -57,11 +57,17 @@ function parse_xlmeta_bin(data, name, _opts) {
|
||||
break;
|
||||
case 51:
|
||||
val.forEach(function(r) {
|
||||
(esmdb == 1 ? out.Cell : out.Value).push({ type: out.Types[r[0] - 1].name, index: r[1] });
|
||||
if (metatype == 1)
|
||||
out.Cell.push({ type: out.Types[r[0] - 1].name, index: r[1] });
|
||||
else if (metatype == 0)
|
||||
out.Value.push({ type: out.Types[r[0] - 1].name, index: r[1] });
|
||||
});
|
||||
break;
|
||||
case 337:
|
||||
esmdb = val ? 1 : 0;
|
||||
metatype = val ? 1 : 0;
|
||||
break;
|
||||
case 338:
|
||||
metatype = 2;
|
||||
break;
|
||||
case 35:
|
||||
state.push(RT);
|
||||
|
@ -24,7 +24,7 @@ function write_BrtMdtinfo(data: BrtMdtinfo): RawData {
|
||||
/* [MS-XLSB] 2.4.697 BrtMdb */
|
||||
type Mdir = [number, number]; // "t", "v" in XLSX parlance
|
||||
type BrtMdb = Mdir[];
|
||||
function parse_BrtMdb(data: ReadableData, length: number): BrtMdb {
|
||||
function parse_BrtMdb(data: ReadableData/*, length: number*/): BrtMdb {
|
||||
var out: Mdir[] = [];
|
||||
var cnt = data.read_shift(4);
|
||||
while(cnt-- > 0) out.push([data.read_shift(4), data.read_shift(4)]);
|
||||
@ -49,7 +49,7 @@ function write_BrtBeginEsfmd(cnt: number, name: string): RawData {
|
||||
}
|
||||
|
||||
/* [MS-XLSB] 2.4.73 BrtBeginEsmdb */
|
||||
function parse_BrtBeginEsmdb(data: ReadableData, length: number): boolean {
|
||||
function parse_BrtBeginEsmdb(data: ReadableData/*, length: number*/): boolean {
|
||||
data.l += 4;
|
||||
return data.read_shift(4) != 0;
|
||||
}
|
||||
@ -66,14 +66,13 @@ function parse_xlmeta_bin(data, name: string, _opts?: ParseXLMetaOptions): XLMet
|
||||
var opts = _opts || {};
|
||||
var state: number[] = [];
|
||||
var pass = false;
|
||||
var esmdb: 0 | 1 = 0;
|
||||
var metatype: 0 | 1 | 2 = 2;
|
||||
recordhopper(data, (val, R, RT) => {
|
||||
switch(RT) {
|
||||
// case 0x014C: /* BrtBeginMetadata */
|
||||
// case 0x014D: /* BrtEndMetadata */
|
||||
// case 0x014E: /* BrtBeginEsmdtinfo */
|
||||
// case 0x0150: /* BrtEndEsmdtinfo */
|
||||
// case 0x0152: /* BrtEndEsmdb */
|
||||
// case 0x0153: /* BrtBeginEsfmd */
|
||||
// case 0x0154: /* BrtEndEsfmd */
|
||||
// case 0x0034: /* BrtBeginFmd */
|
||||
@ -88,11 +87,14 @@ function parse_xlmeta_bin(data, name: string, _opts?: ParseXLMetaOptions): XLMet
|
||||
|
||||
case 0x0033: /* BrtMdb */
|
||||
(val as BrtMdb).forEach(r => {
|
||||
(esmdb == 1 ? out.Cell : out.Value).push({type: out.Types[r[0] - 1].name, index: r[1] });
|
||||
if(metatype == 1) out.Cell.push({type: out.Types[r[0] - 1].name, index: r[1] });
|
||||
else if(metatype == 0) out.Value.push({type: out.Types[r[0] - 1].name, index: r[1] });
|
||||
}); break;
|
||||
|
||||
case 0x0151: /* BrtBeginEsmdb */
|
||||
esmdb = (val as boolean) ? 1 /* cell */ : 0 /* value */; break;
|
||||
metatype = (val as boolean) ? 1 /* cell */ : 0 /* value */; break;
|
||||
case 0x0152: /* BrtEndEsmdb */
|
||||
metatype = 2; break;
|
||||
|
||||
case 0x0023: /* BrtFRTBegin */
|
||||
state.push(RT); pass = true; break;
|
||||
|
@ -3,8 +3,8 @@ function parse_xlmeta_xml(data, name, opts) {
|
||||
if (!data)
|
||||
return out;
|
||||
var pass = false;
|
||||
var metatype = "";
|
||||
data.replace(tagregex, function(x, idx) {
|
||||
var metatype = 2;
|
||||
data.replace(tagregex, function(x) {
|
||||
var y = parsexmltag(x);
|
||||
switch (strip_ns(y[0])) {
|
||||
case "<?xml":
|
||||
@ -29,24 +29,24 @@ function parse_xlmeta_xml(data, name, opts) {
|
||||
case "</bk>":
|
||||
break;
|
||||
case "<rc":
|
||||
if (metatype == "cell")
|
||||
if (metatype == 1)
|
||||
out.Cell.push({ type: out.Types[y.t - 1].name, index: +y.v });
|
||||
else if (metatype == "value")
|
||||
else if (metatype == 0)
|
||||
out.Value.push({ type: out.Types[y.t - 1].name, index: +y.v });
|
||||
break;
|
||||
case "</rc>":
|
||||
break;
|
||||
case "<cellMetadata":
|
||||
metatype = "cell";
|
||||
metatype = 1;
|
||||
break;
|
||||
case "</cellMetadata>":
|
||||
metatype = "";
|
||||
metatype = 2;
|
||||
break;
|
||||
case "<valueMetadata":
|
||||
metatype = "value";
|
||||
metatype = 0;
|
||||
break;
|
||||
case "</valueMetadata>":
|
||||
metatype = "";
|
||||
metatype = 2;
|
||||
break;
|
||||
case "<extLst":
|
||||
case "<extLst>":
|
||||
|
@ -5,9 +5,9 @@ function parse_xlmeta_xml(data: string, name: string, opts?: ParseXLMetaOptions)
|
||||
var out: XLMeta = { Types: [], Cell: [], Value: [] };
|
||||
if(!data) return out;
|
||||
var pass = false;
|
||||
var metatype: "cell" | "value" | "" = "";
|
||||
var metatype: 0 | 1 | 2 = 2;
|
||||
|
||||
data.replace(tagregex, (x: string, idx: number) => {
|
||||
data.replace(tagregex, (x: string/*, idx: number*/) => {
|
||||
var y: any = parsexmltag(x);
|
||||
switch(strip_ns(y[0])) {
|
||||
case '<?xml': break;
|
||||
@ -34,18 +34,18 @@ function parse_xlmeta_xml(data: string, name: string, opts?: ParseXLMetaOptions)
|
||||
|
||||
/* 18.9.15 */
|
||||
case '<rc':
|
||||
if(metatype == "cell") out.Cell.push({ type: out.Types[y.t - 1].name, index: +y.v });
|
||||
else if(metatype == "value") out.Value.push({ type: out.Types[y.t - 1].name, index: +y.v });
|
||||
if(metatype == 1) out.Cell.push({ type: out.Types[y.t - 1].name, index: +y.v });
|
||||
else if(metatype == 0) out.Value.push({ type: out.Types[y.t - 1].name, index: +y.v });
|
||||
break;
|
||||
case '</rc>': break;
|
||||
|
||||
/* 18.9.3 */
|
||||
case '<cellMetadata': metatype = "cell"; break;
|
||||
case '</cellMetadata>': metatype = ""; break;
|
||||
case '<cellMetadata': metatype = 1; break;
|
||||
case '</cellMetadata>': metatype = 2; break;
|
||||
|
||||
/* 18.9.17 */
|
||||
case '<valueMetadata': metatype = "value"; break;
|
||||
case '</valueMetadata>': metatype = ""; break;
|
||||
case '<valueMetadata': metatype = 0; break;
|
||||
case '</valueMetadata>': metatype = 2; break;
|
||||
|
||||
/* 18.2.10 extLst CT_ExtensionList ? */
|
||||
case '<extLst': case '<extLst>': case '</extLst>': case '<extLst/>': break;
|
||||
|
@ -60,43 +60,6 @@ function parse_varint49(buf, ptr) {
|
||||
ptr[0] = l;
|
||||
return usz;
|
||||
}
|
||||
function write_varint49(v) {
|
||||
var usz = new Uint8Array(7);
|
||||
usz[0] = v & 127;
|
||||
var L = 1;
|
||||
sz:
|
||||
if (v > 127) {
|
||||
usz[L - 1] |= 128;
|
||||
usz[L] = v >> 7 & 127;
|
||||
++L;
|
||||
if (v <= 16383)
|
||||
break sz;
|
||||
usz[L - 1] |= 128;
|
||||
usz[L] = v >> 14 & 127;
|
||||
++L;
|
||||
if (v <= 2097151)
|
||||
break sz;
|
||||
usz[L - 1] |= 128;
|
||||
usz[L] = v >> 21 & 127;
|
||||
++L;
|
||||
if (v <= 268435455)
|
||||
break sz;
|
||||
usz[L - 1] |= 128;
|
||||
usz[L] = v / 256 >>> 21 & 127;
|
||||
++L;
|
||||
if (v <= 34359738367)
|
||||
break sz;
|
||||
usz[L - 1] |= 128;
|
||||
usz[L] = v / 65536 >>> 21 & 127;
|
||||
++L;
|
||||
if (v <= 4398046511103)
|
||||
break sz;
|
||||
usz[L - 1] |= 128;
|
||||
usz[L] = v / 16777216 >>> 21 & 127;
|
||||
++L;
|
||||
}
|
||||
return usz.slice(0, L);
|
||||
}
|
||||
function varint_to_i32(buf) {
|
||||
var l = 0, i32 = buf[l] & 127;
|
||||
varint:
|
||||
@ -162,16 +125,6 @@ function parse_shallow(buf) {
|
||||
}
|
||||
return out;
|
||||
}
|
||||
function write_shallow(proto) {
|
||||
var out = [];
|
||||
proto.forEach(function(field, idx) {
|
||||
field.forEach(function(item) {
|
||||
out.push(write_varint49(idx * 8 + item.type));
|
||||
out.push(item.data);
|
||||
});
|
||||
});
|
||||
return u8concat(out);
|
||||
}
|
||||
function mappa(data, cb) {
|
||||
if (!data)
|
||||
return [];
|
||||
|
@ -55,6 +55,7 @@ function parse_varint49(buf: Uint8Array, ptr?: Ptr): number {
|
||||
if(ptr) ptr[0] = l;
|
||||
return usz;
|
||||
}
|
||||
/*
|
||||
function write_varint49(v: number): Uint8Array {
|
||||
var usz = new Uint8Array(7);
|
||||
usz[0] = (v & 0x7F);
|
||||
@ -74,6 +75,7 @@ function write_varint49(v: number): Uint8Array {
|
||||
}
|
||||
return usz.slice(0, L);
|
||||
}
|
||||
*/
|
||||
|
||||
/** Parse a 32-bit signed integer from the raw varint */
|
||||
function varint_to_i32(buf: Uint8Array): number {
|
||||
@ -124,6 +126,7 @@ function parse_shallow(buf: Uint8Array): ProtoMessage {
|
||||
return out;
|
||||
}
|
||||
/** Serialize a shallow parse */
|
||||
/*
|
||||
function write_shallow(proto: ProtoMessage): Uint8Array {
|
||||
var out: Uint8Array[] = [];
|
||||
proto.forEach((field, idx) => {
|
||||
@ -134,6 +137,7 @@ function write_shallow(proto: ProtoMessage): Uint8Array {
|
||||
});
|
||||
return u8concat(out);
|
||||
}
|
||||
*/
|
||||
|
||||
function mappa<U>(data: ProtoField, cb:(Uint8Array) => U): U[] {
|
||||
if(!data) return [];
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xlsx",
|
||||
"version": "0.18.3",
|
||||
"version": "0.18.4",
|
||||
"author": "sheetjs",
|
||||
"description": "SheetJS Spreadsheet data parser and writer",
|
||||
"keywords": [
|
||||
|
19
test.js
19
test.js
@ -165,6 +165,9 @@ var paths = {
|
||||
lonxls: dir + 'LONumbers.xls',
|
||||
lonxlsx: dir + 'LONumbers.xlsx',
|
||||
|
||||
m19xlsx: dir + 'metadata_2019.xlsx',
|
||||
m19xlsb: dir + 'metadata_2019.xlsb',
|
||||
|
||||
mcxls: dir + 'merge_cells.xls',
|
||||
mcxml: dir + 'merge_cells.xls.xml',
|
||||
mcxlsx: dir + 'merge_cells.xlsx',
|
||||
@ -1576,6 +1579,22 @@ describe('roundtrip features', function() {
|
||||
});
|
||||
}); }); });
|
||||
|
||||
describe('should preserve dynamic array formulae', function() { [
|
||||
['xlsx', paths.m19xlsx]
|
||||
].forEach(function(w) { it(w[0], function() {
|
||||
var wb1 = X.read(fs.readFileSync(w[1]), {xlfn: true, type:TYPE, cellFormula:true, WTF:1});
|
||||
var wb2 = X.read(X.write(wb1, {bookType:w[0], type:TYPE}), {cellFormula:true, xlfn: true, type:TYPE, WTF:1});
|
||||
assert.equal(!!get_cell(wb2.Sheets.Sheet1, "B3").D, true);
|
||||
assert.equal(!!get_cell(wb2.Sheets.Sheet1, "B13").D, true);
|
||||
assert.equal(!!get_cell(wb2.Sheets.Sheet1, "C13").D, true);
|
||||
|
||||
get_cell(wb2.Sheets.Sheet1, "B3").D = false;
|
||||
var wb3 = X.read(X.write(wb2, {bookType:w[0], type:TYPE}), {cellFormula:true, xlfn: true, type:TYPE, WTF:1});
|
||||
assert.equal(!!get_cell(wb3.Sheets.Sheet1, "B3").D, false);
|
||||
assert.equal(!!get_cell(wb3.Sheets.Sheet1, "B13").D, true);
|
||||
assert.equal(!!get_cell(wb3.Sheets.Sheet1, "C13").D, true);
|
||||
}); }); });
|
||||
|
||||
describe('should preserve hyperlink', function() { [
|
||||
['xlml', paths.hlxml, true],
|
||||
['xls', paths.hlxls, true],
|
||||
|
19
test.mjs
generated
19
test.mjs
generated
@ -166,6 +166,9 @@ var paths = {
|
||||
lonxls: dir + 'LONumbers.xls',
|
||||
lonxlsx: dir + 'LONumbers.xlsx',
|
||||
|
||||
m19xlsx: dir + 'metadata_2019.xlsx',
|
||||
m19xlsb: dir + 'metadata_2019.xlsb',
|
||||
|
||||
mcxls: dir + 'merge_cells.xls',
|
||||
mcxml: dir + 'merge_cells.xls.xml',
|
||||
mcxlsx: dir + 'merge_cells.xlsx',
|
||||
@ -1562,6 +1565,22 @@ describe('roundtrip features', function() {
|
||||
});
|
||||
}); }); });
|
||||
|
||||
describe('should preserve dynamic array formulae', function() { [
|
||||
['xlsx', paths.m19xlsx]
|
||||
].forEach(function(w) { it(w[0], function() {
|
||||
var wb1 = X.read(fs.readFileSync(w[1]), {xlfn: true, type:TYPE, cellFormula:true, WTF:1});
|
||||
var wb2 = X.read(X.write(wb1, {bookType:w[0], type:TYPE}), {cellFormula:true, xlfn: true, type:TYPE, WTF:1});
|
||||
assert.equal(!!get_cell(wb2.Sheets.Sheet1, "B3").D, true);
|
||||
assert.equal(!!get_cell(wb2.Sheets.Sheet1, "B13").D, true);
|
||||
assert.equal(!!get_cell(wb2.Sheets.Sheet1, "C13").D, true);
|
||||
|
||||
get_cell(wb2.Sheets.Sheet1, "B3").D = false;
|
||||
var wb3 = X.read(X.write(wb2, {bookType:w[0], type:TYPE}), {cellFormula:true, xlfn: true, type:TYPE, WTF:1});
|
||||
assert.equal(!!get_cell(wb3.Sheets.Sheet1, "B3").D, false);
|
||||
assert.equal(!!get_cell(wb3.Sheets.Sheet1, "B13").D, true);
|
||||
assert.equal(!!get_cell(wb3.Sheets.Sheet1, "C13").D, true);
|
||||
}); }); });
|
||||
|
||||
describe('should preserve hyperlink', function() { [
|
||||
['xlml', paths.hlxml, true],
|
||||
['xls', paths.hlxls, true],
|
||||
|
19
test.ts
19
test.ts
@ -186,6 +186,9 @@ var paths: any = {
|
||||
lonxls: dir + 'LONumbers.xls',
|
||||
lonxlsx: dir + 'LONumbers.xlsx',
|
||||
|
||||
m19xlsx: dir + 'metadata_2019.xlsx',
|
||||
m19xlsb: dir + 'metadata_2019.xlsb',
|
||||
|
||||
mcxls: dir + 'merge_cells.xls',
|
||||
mcxml: dir + 'merge_cells.xls.xml',
|
||||
mcxlsx: dir + 'merge_cells.xlsx',
|
||||
@ -1521,6 +1524,22 @@ Deno.test('roundtrip features', async function(t) {
|
||||
});
|
||||
}); } });
|
||||
|
||||
await t.step('should preserve dynamic array formulae', async function(t) { var m19 = [
|
||||
['xlsx', paths.m19xlsx]
|
||||
]; for(var h1 = 0; h1 < m19.length; ++h1) { var w = m19[h1]; await t.step(w[0], async function (t) {
|
||||
var wb1 = X.read(fs.readFileSync(w[1]), {xlfn: true, type:TYPE, cellFormula:true, WTF:true});
|
||||
var wb2 = X.read(X.write(wb1, {bookType:w[0], type:TYPE}), {cellFormula:true, xlfn: true, type:TYPE, WTF:true});
|
||||
assert.equal(!!get_cell(wb2.Sheets.Sheet1, "B3").D, true);
|
||||
assert.equal(!!get_cell(wb2.Sheets.Sheet1, "B13").D, true);
|
||||
assert.equal(!!get_cell(wb2.Sheets.Sheet1, "C13").D, true);
|
||||
|
||||
get_cell(wb2.Sheets.Sheet1, "B3").D = false;
|
||||
var wb3 = X.read(X.write(wb2, {bookType:w[0], type:TYPE}), {cellFormula:true, xlfn: true, type:TYPE, WTF:true});
|
||||
assert.equal(!!get_cell(wb3.Sheets.Sheet1, "B3").D, false);
|
||||
assert.equal(!!get_cell(wb3.Sheets.Sheet1, "B13").D, true);
|
||||
assert.equal(!!get_cell(wb3.Sheets.Sheet1, "C13").D, true);
|
||||
}); } });
|
||||
|
||||
await t.step('should preserve hyperlink', async function(t) { var hl = [
|
||||
['xlml', paths.hlxml, true],
|
||||
['xls', paths.hlxls, true],
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit c0f37ad3d8a49cd5abb98dba59011ffa4d46cfc0
|
||||
Subproject commit b70d2b6f15741e567ef1418345b34141ecd0ebb2
|
20
tests/core.js
generated
20
tests/core.js
generated
@ -165,6 +165,9 @@ var paths = {
|
||||
lonxls: dir + 'LONumbers.xls',
|
||||
lonxlsx: dir + 'LONumbers.xlsx',
|
||||
|
||||
m19xlsx: dir + 'metadata_2019.xlsx',
|
||||
m19xlsb: dir + 'metadata_2019.xlsb',
|
||||
|
||||
mcxls: dir + 'merge_cells.xls',
|
||||
mcxml: dir + 'merge_cells.xls.xml',
|
||||
mcxlsx: dir + 'merge_cells.xlsx',
|
||||
@ -1576,6 +1579,23 @@ describe('roundtrip features', function() {
|
||||
});
|
||||
}); }); });
|
||||
|
||||
describe('should preserve dynamic array formulae', function() { [
|
||||
['xlsx', paths.m19xlsx]
|
||||
].forEach(function(w) { it(w[0], function() {
|
||||
var wb1 = X.read(fs.readFileSync(w[1]), {xlfn: true, type:TYPE, cellFormula:true, WTF:1});
|
||||
var wb2 = X.read(X.write(wb1, {bookType:w[0], type:TYPE}), {cellFormula:true, xlfn: true, type:TYPE, WTF:1});
|
||||
assert.equal(!!get_cell(wb2.Sheets.Sheet1, "B3").D, true);
|
||||
assert.equal(!!get_cell(wb2.Sheets.Sheet1, "B13").D, true);
|
||||
assert.equal(!!get_cell(wb2.Sheets.Sheet1, "C13").D, true);
|
||||
|
||||
get_cell(wb2.Sheets.Sheet1, "B3").D = false;
|
||||
console.log(wb2.Sheets.Sheet1);
|
||||
var wb3 = X.read(X.write(wb2, {bookType:w[0], type:TYPE}), {cellFormula:true, xlfn: true, type:TYPE, WTF:1});
|
||||
assert.equal(!!get_cell(wb3.Sheets.Sheet1, "B3").D, false);
|
||||
assert.equal(!!get_cell(wb3.Sheets.Sheet1, "B13").D, true);
|
||||
assert.equal(!!get_cell(wb3.Sheets.Sheet1, "C13").D, true);
|
||||
}); }); });
|
||||
|
||||
describe('should preserve hyperlink', function() { [
|
||||
['xlml', paths.hlxml, true],
|
||||
['xls', paths.hlxls, true],
|
||||
|
2
tests/fixtures.js
generated
2
tests/fixtures.js
generated
File diff suppressed because one or more lines are too long
@ -96,6 +96,8 @@
|
||||
./test_files/merge_cells.xlsx
|
||||
./test_files/merge_cells.xlsb
|
||||
./test_files/merge_cells.ods
|
||||
./test_files/metadata_2019.xlsx
|
||||
./test_files/metadata_2019.xlsb
|
||||
./test_files/named_ranges_2011.xls.xml
|
||||
./test_files/named_ranges_2011.xlsb
|
||||
./test_files/named_ranges_2011.xlsx
|
||||
|
2086
xlsx.flow.js
2086
xlsx.flow.js
File diff suppressed because it is too large
Load Diff
1125
xlsx.mini.flow.js
1125
xlsx.mini.flow.js
File diff suppressed because it is too large
Load Diff
1082
xlsx.mini.js
1082
xlsx.mini.js
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user