forked from sheetjs/sheetjs
slk defined name parse
This commit is contained in:
parent
cfe4da2e56
commit
2ff31276b0
11
README.md
11
README.md
@ -2588,6 +2588,17 @@ XLSX.write(wb, {Props:{Author:"SheetJS"}});
|
||||
|
||||
#### Defined Names
|
||||
|
||||
<details>
|
||||
<summary><b>Format Support</b> (click to show)</summary>
|
||||
|
||||
**Defined Names**: XLSX/M, XLSB, BIFF8 XLS, XLML, SYLK
|
||||
|
||||
**Unicode Defined Names**: XLSX/M, XLSB, BIFF8 XLS, XLML
|
||||
|
||||
**Defined Name Comment**: XLSX/M, XLSB, BIFF8 XLS
|
||||
|
||||
</details>
|
||||
|
||||
`wb.Workbook.Names` is an array of defined name objects which have the keys:
|
||||
|
||||
<details>
|
||||
|
@ -391,7 +391,7 @@ var SYLK = /*#__PURE__*/(function() {
|
||||
var sylk_char_fn = function(_, $1){ var o = sylk_escapes[$1]; return typeof o == "number" ? _getansi(o) : o; };
|
||||
var decode_sylk_char = function($$, $1, $2) { var newcc = (($1.charCodeAt(0) - 0x20)<<4) | ($2.charCodeAt(0) - 0x30); return newcc == 59 ? $$ : _getansi(newcc); };
|
||||
sylk_escapes["|"] = 254;
|
||||
/* TODO: find an actual specification */
|
||||
/* https://oss.sheetjs.com/notes/sylk/ for more details */
|
||||
function sylk_to_aoa(d/*:RawData*/, opts)/*:[AOA, Worksheet]*/ {
|
||||
switch(opts.type) {
|
||||
case 'base64': return sylk_to_aoa_str(Base64_decode(d), opts);
|
||||
@ -407,7 +407,7 @@ var SYLK = /*#__PURE__*/(function() {
|
||||
var next_cell_format/*:string|null*/ = null;
|
||||
var sht = {}, rowinfo/*:Array<RowInfo>*/ = [], colinfo/*:Array<ColInfo>*/ = [], cw/*:Array<string>*/ = [];
|
||||
var Mval = 0, j;
|
||||
var wb = { Workbook: { WBProps: {} } };
|
||||
var wb = { Workbook: { WBProps: {}, Names: [] } };
|
||||
if(+opts.codepage >= 0) set_cp(+opts.codepage);
|
||||
for (; ri !== records.length; ++ri) {
|
||||
Mval = 0;
|
||||
@ -426,12 +426,20 @@ var SYLK = /*#__PURE__*/(function() {
|
||||
if(d1904 >= 1 && d1904 <= 4) wb.Workbook.WBProps.date1904 = true;
|
||||
} break;
|
||||
} break;
|
||||
case 'W': break; /* window? */
|
||||
case 'W': break; /* window */
|
||||
case 'P':
|
||||
if(record[1].charAt(0) == 'P')
|
||||
formats.push(rstr.slice(3).replace(/;;/g, ";"));
|
||||
break;
|
||||
case 'C':
|
||||
case 'NN': { /* defined name */
|
||||
var nn = {Sheet: 0};
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'N': nn.Name = record[rj].slice(1); break;
|
||||
case 'E': nn.Ref = (opts && opts.sheet || "Sheet1") + "!" + rc_to_a1(record[rj].slice(1)); break;
|
||||
}
|
||||
wb.Workbook.Names.push(nn);
|
||||
} break;
|
||||
case 'C': /* cell */
|
||||
var C_seen_K = false, C_seen_X = false, C_seen_S = false, C_seen_E = false, _R = -1, _C = -1;
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'A': break; // TODO: comment
|
||||
@ -480,7 +488,7 @@ var SYLK = /*#__PURE__*/(function() {
|
||||
arr[R][C][1] = shift_formula_str(shrbase[1], {r: R - _R, c: C - _C});
|
||||
}
|
||||
break;
|
||||
case 'F':
|
||||
case 'F': /* Format */
|
||||
var F_seen = 0;
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'X': C = parseInt(record[rj].slice(1), 10)-1; ++F_seen; break;
|
||||
|
@ -862,7 +862,7 @@ var WK_ = /*#__PURE__*/(function() {
|
||||
break;
|
||||
case 0x02: /* EOF */ break outer;
|
||||
|
||||
/* TODO: The behavior here should be consistent with Numbers: QP Notebook ~ .TN.SheetArchive, QP Sheet ~ .TST.TSTable */
|
||||
/* TODO: The behavior here should be consistent with Numbers: QP Notebook ~ .TN.SheetArchive, QP Sheet ~ .TST.TableModelArchive */
|
||||
case 0x0401: /* BON */ break;
|
||||
case 0x0402: /* EON */ /* TODO: backfill missing sheets based on BON cnt */ break;
|
||||
|
||||
|
@ -4,6 +4,17 @@
|
||||
|
||||
#### Defined Names
|
||||
|
||||
<details>
|
||||
<summary><b>Format Support</b> (click to show)</summary>
|
||||
|
||||
**Defined Names**: XLSX/M, XLSB, BIFF8 XLS, XLML, SYLK
|
||||
|
||||
**Unicode Defined Names**: XLSX/M, XLSB, BIFF8 XLS, XLML
|
||||
|
||||
**Defined Name Comment**: XLSX/M, XLSB, BIFF8 XLS
|
||||
|
||||
</details>
|
||||
|
||||
`wb.Workbook.Names` is an array of defined name objects which have the keys:
|
||||
|
||||
<details>
|
||||
|
@ -2438,6 +2438,14 @@ XLSX.write(wb, {Props:{Author:"SheetJS"}});
|
||||
|
||||
#### Defined Names
|
||||
|
||||
|
||||
**Defined Names**: XLSX/M, XLSB, BIFF8 XLS, XLML, SYLK
|
||||
|
||||
**Unicode Defined Names**: XLSX/M, XLSB, BIFF8 XLS, XLML
|
||||
|
||||
**Defined Name Comment**: XLSX/M, XLSB, BIFF8 XLS
|
||||
|
||||
|
||||
`wb.Workbook.Names` is an array of defined name objects which have the keys:
|
||||
|
||||
|
||||
|
7
test.js
7
test.js
@ -132,6 +132,7 @@ var paths = {
|
||||
dnsxml: dir + 'defined_names_simple.xml',
|
||||
dnsxlsx: dir + 'defined_names_simple.xlsx',
|
||||
dnsxlsb: dir + 'defined_names_simple.xlsb',
|
||||
dnsslk: dir + 'defined_names_simple.slk',
|
||||
|
||||
dnuxls: dir + 'defined_names_unicode.xls',
|
||||
dnuxml: dir + 'defined_names_unicode.xml',
|
||||
@ -1183,15 +1184,19 @@ describe('parse features', function() {
|
||||
['xlsx', paths.dnsxlsx, true],
|
||||
['xlsb', paths.dnsxlsb, true],
|
||||
['xls', paths.dnsxls, true],
|
||||
['xlml', paths.dnsxml, false]
|
||||
['xlml', paths.dnsxml, false],
|
||||
['slk', paths.dnsslk, false]
|
||||
].forEach(function(m) { it(m[0], function() {
|
||||
var wb = X.read(fs.readFileSync(m[1]), {type:TYPE});
|
||||
var names = wb.Workbook.Names;
|
||||
|
||||
if(m[0] != 'slk') {
|
||||
for(var i = 0; i < names.length; ++i) if(names[i].Name == "SheetJS") break;
|
||||
assert(i < names.length, "Missing name");
|
||||
assert.equal(names[i].Sheet, null);
|
||||
assert.equal(names[i].Ref, "Sheet1!$A$1");
|
||||
if(m[2]) assert.equal(names[i].Comment, "defined names just suck excel formulae are bad MS should feel bad");
|
||||
}
|
||||
|
||||
for(i = 0; i < names.length; ++i) if(names[i].Name == "SHEETjs") break;
|
||||
assert(i < names.length, "Missing name");
|
||||
|
10
test.ts
10
test.ts
@ -154,6 +154,7 @@ var paths: any = {
|
||||
dnsxml: dir + 'defined_names_simple.xml',
|
||||
dnsxlsx: dir + 'defined_names_simple.xlsx',
|
||||
dnsxlsb: dir + 'defined_names_simple.xlsb',
|
||||
dnsslk: dir + 'defined_names_simple.slk',
|
||||
|
||||
dnuxls: dir + 'defined_names_unicode.xls',
|
||||
dnuxml: dir + 'defined_names_unicode.xml',
|
||||
@ -1158,15 +1159,20 @@ Deno.test('parse features', async function(t) {
|
||||
['xlsx', paths.dnsxlsx, true],
|
||||
['xlsb', paths.dnsxlsb, true],
|
||||
['xls', paths.dnsxls, true],
|
||||
['xlml', paths.dnsxml, false]
|
||||
['xlml', paths.dnsxml, false],
|
||||
['slk', paths.dnsslk, false]
|
||||
] as Array<[string, string, boolean]>; for(var i = 0; i < dnp.length; ++i) { let m: [string, string, boolean] = dnp[i]; await t.step(m[0], async function(t) {
|
||||
var wb = X.read(fs.readFileSync(m[1]), {type:TYPE});
|
||||
var names = wb?.Workbook?.Names;
|
||||
if(names) {for(var i = 0; i < names?.length; ++i) if(names[i].Name == "SheetJS") break;
|
||||
|
||||
if(names) {
|
||||
if(m[0] != 'slk') {
|
||||
for(var i = 0; i < names?.length; ++i) if(names[i].Name == "SheetJS") break;
|
||||
assert.assert(i < names?.length, "Missing name");
|
||||
assert.equal(names[i].Sheet, void 0);
|
||||
assert.equal(names[i].Ref, "Sheet1!$A$1");
|
||||
if(m[2]) assert.equal(names[i].Comment, "defined names just suck excel formulae are bad MS should feel bad");
|
||||
}
|
||||
|
||||
for(i = 0; i < names.length; ++i) if(names[i].Name == "SHEETjs") break;
|
||||
assert.assert(i < names.length, "Missing name");
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 59a810302a68b26d6c9c3f9c4e7f499b0fdd6d37
|
||||
Subproject commit 50158c2288492df6f6eb4037568023a3de3e0ef9
|
@ -62,6 +62,7 @@
|
||||
./test_files/defined_names_simple.xml
|
||||
./test_files/defined_names_simple.xlsx
|
||||
./test_files/defined_names_simple.xlsb
|
||||
./test_files/defined_names_simple.slk
|
||||
./test_files/defined_names_unicode.xls
|
||||
./test_files/defined_names_unicode.xml
|
||||
./test_files/defined_names_unicode.ods
|
||||
|
40
xlsx.flow.js
40
xlsx.flow.js
@ -7942,7 +7942,7 @@ var SYLK = /*#__PURE__*/(function() {
|
||||
var sylk_char_fn = function(_, $1){ var o = sylk_escapes[$1]; return typeof o == "number" ? _getansi(o) : o; };
|
||||
var decode_sylk_char = function($$, $1, $2) { var newcc = (($1.charCodeAt(0) - 0x20)<<4) | ($2.charCodeAt(0) - 0x30); return newcc == 59 ? $$ : _getansi(newcc); };
|
||||
sylk_escapes["|"] = 254;
|
||||
/* TODO: find an actual specification */
|
||||
/* https://oss.sheetjs.com/notes/sylk/ for more details */
|
||||
function sylk_to_aoa(d/*:RawData*/, opts)/*:[AOA, Worksheet]*/ {
|
||||
switch(opts.type) {
|
||||
case 'base64': return sylk_to_aoa_str(Base64_decode(d), opts);
|
||||
@ -7958,7 +7958,7 @@ var SYLK = /*#__PURE__*/(function() {
|
||||
var next_cell_format/*:string|null*/ = null;
|
||||
var sht = {}, rowinfo/*:Array<RowInfo>*/ = [], colinfo/*:Array<ColInfo>*/ = [], cw/*:Array<string>*/ = [];
|
||||
var Mval = 0, j;
|
||||
var wb = { Workbook: { WBProps: {} } };
|
||||
var wb = { Workbook: { WBProps: {}, Names: [] } };
|
||||
if(+opts.codepage >= 0) set_cp(+opts.codepage);
|
||||
for (; ri !== records.length; ++ri) {
|
||||
Mval = 0;
|
||||
@ -7977,12 +7977,20 @@ var SYLK = /*#__PURE__*/(function() {
|
||||
if(d1904 >= 1 && d1904 <= 4) wb.Workbook.WBProps.date1904 = true;
|
||||
} break;
|
||||
} break;
|
||||
case 'W': break; /* window? */
|
||||
case 'W': break; /* window */
|
||||
case 'P':
|
||||
if(record[1].charAt(0) == 'P')
|
||||
formats.push(rstr.slice(3).replace(/;;/g, ";"));
|
||||
break;
|
||||
case 'C':
|
||||
case 'NN': { /* defined name */
|
||||
var nn = {Sheet: 0};
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'N': nn.Name = record[rj].slice(1); break;
|
||||
case 'E': nn.Ref = (opts && opts.sheet || "Sheet1") + "!" + rc_to_a1(record[rj].slice(1)); break;
|
||||
}
|
||||
wb.Workbook.Names.push(nn);
|
||||
} break;
|
||||
case 'C': /* cell */
|
||||
var C_seen_K = false, C_seen_X = false, C_seen_S = false, C_seen_E = false, _R = -1, _C = -1;
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'A': break; // TODO: comment
|
||||
@ -8031,7 +8039,7 @@ var SYLK = /*#__PURE__*/(function() {
|
||||
arr[R][C][1] = shift_formula_str(shrbase[1], {r: R - _R, c: C - _C});
|
||||
}
|
||||
break;
|
||||
case 'F':
|
||||
case 'F': /* Format */
|
||||
var F_seen = 0;
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'X': C = parseInt(record[rj].slice(1), 10)-1; ++F_seen; break;
|
||||
@ -9448,7 +9456,7 @@ var WK_ = /*#__PURE__*/(function() {
|
||||
break;
|
||||
case 0x02: /* EOF */ break outer;
|
||||
|
||||
/* TODO: The behavior here should be consistent with Numbers: QP Notebook ~ .TN.SheetArchive, QP Sheet ~ .TST.TSTable */
|
||||
/* TODO: The behavior here should be consistent with Numbers: QP Notebook ~ .TN.SheetArchive, QP Sheet ~ .TST.TableModelArchive */
|
||||
case 0x0401: /* BON */ break;
|
||||
case 0x0402: /* EON */ /* TODO: backfill missing sheets based on BON cnt */ break;
|
||||
|
||||
@ -20664,6 +20672,16 @@ var XLSRecordEnum = {
|
||||
/*::[*/0x08cb/*::]*/: { /* n:"CrtCoopt", */ },
|
||||
/*::[*/0x08d6/*::]*/: { /* n:"FRTArchId$", */ r:12 },
|
||||
|
||||
/* --- multiplan 4 records --- */
|
||||
/*::[*/0x0065/*::]*/: { /* n:"", */ }, // one per window
|
||||
/*::[*/0x0066/*::]*/: { /* n:"", */ }, // calc settings
|
||||
/*::[*/0x0069/*::]*/: { /* n:"", */ }, // print header
|
||||
/*::[*/0x006a/*::]*/: { /* n:"", */ }, // print footer
|
||||
/*::[*/0x006b/*::]*/: { /* n:"", */ }, // print settings
|
||||
/*::[*/0x006d/*::]*/: { /* n:"", */ }, // one per window
|
||||
/*::[*/0x0070/*::]*/: { /* n:"", */ }, // includes default col width
|
||||
/*::[*/0x0072/*::]*/: { /* n:"", */ }, // includes selected cell
|
||||
|
||||
/*::[*/0x7262/*::]*/: {}
|
||||
};
|
||||
|
||||
@ -21256,7 +21274,7 @@ function sheet_add_dom(ws/*:Worksheet*/, table/*:HTMLElement*/, _opts/*:?any*/)/
|
||||
if(Aelts && Aelts.length) for(var Aelti = 0; Aelti < Aelts.length; ++Aelti) if(Aelts[Aelti].hasAttribute("href")) {
|
||||
l = Aelts[Aelti].getAttribute("href"); if(l.charAt(0) != "#") break;
|
||||
}
|
||||
if(l && l.charAt(0) != "#") o.l = ({ Target: l });
|
||||
if(l && l.charAt(0) != "#" && l.slice(0, 11).toLowerCase() != 'javascript:') o.l = ({ Target: l });
|
||||
if(opts.dense) { if(!ws[R + or_R]) ws[R + or_R] = []; ws[R + or_R][C + or_C] = o; }
|
||||
else ws[encode_cell({c:C + or_C, r:R + or_R})] = o;
|
||||
if(range.e.c < C + or_C) range.e.c = C + or_C;
|
||||
@ -21296,8 +21314,7 @@ function get_get_computed_style_function(element/*:HTMLElement*/)/*:?function*/
|
||||
// If it is not available, try to get one from the global namespace
|
||||
if(typeof getComputedStyle === 'function') return getComputedStyle;
|
||||
return null;
|
||||
}
|
||||
/* OpenDocument */
|
||||
}/* OpenDocument */
|
||||
function parse_text_p(text/*:string*//*::, tag*/)/*:Array<any>*/ {
|
||||
/* 6.1.2 White Space Characters */
|
||||
var fixed = text
|
||||
@ -24084,6 +24101,11 @@ function readSync(data/*:RawData*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
|
||||
case 0x7B: if(n[1] === 0x5C && n[2] === 0x72 && n[3] === 0x74) return RTF.to_workbook(d, o); break;
|
||||
case 0x0A: case 0x0D: case 0x20: return read_plaintext_raw(d, o);
|
||||
case 0x89: if(n[1] === 0x50 && n[2] === 0x4E && n[3] === 0x47) throw new Error("PNG Image File is not a spreadsheet"); break;
|
||||
case 0x08: if(n[1] === 0xE7) throw new Error("Unsupported Multiplan 1.x file!"); break;
|
||||
case 0x0C:
|
||||
if(n[1] === 0xEC) throw new Error("Unsupported Multiplan 2.x file!");
|
||||
if(n[1] === 0xED) throw new Error("Unsupported Multiplan 3.x file!");
|
||||
break;
|
||||
}
|
||||
if(DBF_SUPPORTED_VERSIONS.indexOf(n[0]) > -1 && n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o);
|
||||
return read_prn(data, d, o, str);
|
||||
|
40
xlsx.js
generated
40
xlsx.js
generated
@ -7852,7 +7852,7 @@ var SYLK = (function() {
|
||||
var sylk_char_fn = function(_, $1){ var o = sylk_escapes[$1]; return typeof o == "number" ? _getansi(o) : o; };
|
||||
var decode_sylk_char = function($$, $1, $2) { var newcc = (($1.charCodeAt(0) - 0x20)<<4) | ($2.charCodeAt(0) - 0x30); return newcc == 59 ? $$ : _getansi(newcc); };
|
||||
sylk_escapes["|"] = 254;
|
||||
/* TODO: find an actual specification */
|
||||
/* https://oss.sheetjs.com/notes/sylk/ for more details */
|
||||
function sylk_to_aoa(d, opts) {
|
||||
switch(opts.type) {
|
||||
case 'base64': return sylk_to_aoa_str(Base64_decode(d), opts);
|
||||
@ -7868,7 +7868,7 @@ var SYLK = (function() {
|
||||
var next_cell_format = null;
|
||||
var sht = {}, rowinfo = [], colinfo = [], cw = [];
|
||||
var Mval = 0, j;
|
||||
var wb = { Workbook: { WBProps: {} } };
|
||||
var wb = { Workbook: { WBProps: {}, Names: [] } };
|
||||
if(+opts.codepage >= 0) set_cp(+opts.codepage);
|
||||
for (; ri !== records.length; ++ri) {
|
||||
Mval = 0;
|
||||
@ -7887,12 +7887,20 @@ var SYLK = (function() {
|
||||
if(d1904 >= 1 && d1904 <= 4) wb.Workbook.WBProps.date1904 = true;
|
||||
} break;
|
||||
} break;
|
||||
case 'W': break; /* window? */
|
||||
case 'W': break; /* window */
|
||||
case 'P':
|
||||
if(record[1].charAt(0) == 'P')
|
||||
formats.push(rstr.slice(3).replace(/;;/g, ";"));
|
||||
break;
|
||||
case 'C':
|
||||
case 'NN': { /* defined name */
|
||||
var nn = {Sheet: 0};
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'N': nn.Name = record[rj].slice(1); break;
|
||||
case 'E': nn.Ref = (opts && opts.sheet || "Sheet1") + "!" + rc_to_a1(record[rj].slice(1)); break;
|
||||
}
|
||||
wb.Workbook.Names.push(nn);
|
||||
} break;
|
||||
case 'C': /* cell */
|
||||
var C_seen_K = false, C_seen_X = false, C_seen_S = false, C_seen_E = false, _R = -1, _C = -1;
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'A': break; // TODO: comment
|
||||
@ -7941,7 +7949,7 @@ var SYLK = (function() {
|
||||
arr[R][C][1] = shift_formula_str(shrbase[1], {r: R - _R, c: C - _C});
|
||||
}
|
||||
break;
|
||||
case 'F':
|
||||
case 'F': /* Format */
|
||||
var F_seen = 0;
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'X': C = parseInt(record[rj].slice(1), 10)-1; ++F_seen; break;
|
||||
@ -9358,7 +9366,7 @@ var WK_ = (function() {
|
||||
break;
|
||||
case 0x02: /* EOF */ break outer;
|
||||
|
||||
/* TODO: The behavior here should be consistent with Numbers: QP Notebook ~ .TN.SheetArchive, QP Sheet ~ .TST.TSTable */
|
||||
/* TODO: The behavior here should be consistent with Numbers: QP Notebook ~ .TN.SheetArchive, QP Sheet ~ .TST.TableModelArchive */
|
||||
case 0x0401: /* BON */ break;
|
||||
case 0x0402: /* EON */ /* TODO: backfill missing sheets based on BON cnt */ break;
|
||||
|
||||
@ -20555,6 +20563,16 @@ var XLSRecordEnum = {
|
||||
0x08cb: { /* n:"CrtCoopt", */ },
|
||||
0x08d6: { /* n:"FRTArchId$", */ r:12 },
|
||||
|
||||
/* --- multiplan 4 records --- */
|
||||
0x0065: { /* n:"", */ }, // one per window
|
||||
0x0066: { /* n:"", */ }, // calc settings
|
||||
0x0069: { /* n:"", */ }, // print header
|
||||
0x006a: { /* n:"", */ }, // print footer
|
||||
0x006b: { /* n:"", */ }, // print settings
|
||||
0x006d: { /* n:"", */ }, // one per window
|
||||
0x0070: { /* n:"", */ }, // includes default col width
|
||||
0x0072: { /* n:"", */ }, // includes selected cell
|
||||
|
||||
0x7262: {}
|
||||
};
|
||||
|
||||
@ -21146,7 +21164,7 @@ function sheet_add_dom(ws, table, _opts) {
|
||||
if(Aelts && Aelts.length) for(var Aelti = 0; Aelti < Aelts.length; ++Aelti) if(Aelts[Aelti].hasAttribute("href")) {
|
||||
l = Aelts[Aelti].getAttribute("href"); if(l.charAt(0) != "#") break;
|
||||
}
|
||||
if(l && l.charAt(0) != "#") o.l = ({ Target: l });
|
||||
if(l && l.charAt(0) != "#" && l.slice(0, 11).toLowerCase() != 'javascript:') o.l = ({ Target: l });
|
||||
if(opts.dense) { if(!ws[R + or_R]) ws[R + or_R] = []; ws[R + or_R][C + or_C] = o; }
|
||||
else ws[encode_cell({c:C + or_C, r:R + or_R})] = o;
|
||||
if(range.e.c < C + or_C) range.e.c = C + or_C;
|
||||
@ -21186,8 +21204,7 @@ function get_get_computed_style_function(element) {
|
||||
// If it is not available, try to get one from the global namespace
|
||||
if(typeof getComputedStyle === 'function') return getComputedStyle;
|
||||
return null;
|
||||
}
|
||||
/* OpenDocument */
|
||||
}/* OpenDocument */
|
||||
function parse_text_p(text) {
|
||||
/* 6.1.2 White Space Characters */
|
||||
var fixed = text
|
||||
@ -23970,6 +23987,11 @@ function readSync(data, opts) {
|
||||
case 0x7B: if(n[1] === 0x5C && n[2] === 0x72 && n[3] === 0x74) return RTF.to_workbook(d, o); break;
|
||||
case 0x0A: case 0x0D: case 0x20: return read_plaintext_raw(d, o);
|
||||
case 0x89: if(n[1] === 0x50 && n[2] === 0x4E && n[3] === 0x47) throw new Error("PNG Image File is not a spreadsheet"); break;
|
||||
case 0x08: if(n[1] === 0xE7) throw new Error("Unsupported Multiplan 1.x file!"); break;
|
||||
case 0x0C:
|
||||
if(n[1] === 0xEC) throw new Error("Unsupported Multiplan 2.x file!");
|
||||
if(n[1] === 0xED) throw new Error("Unsupported Multiplan 3.x file!");
|
||||
break;
|
||||
}
|
||||
if(DBF_SUPPORTED_VERSIONS.indexOf(n[0]) > -1 && n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o);
|
||||
return read_prn(data, d, o, str);
|
||||
|
40
xlsx.mjs
generated
40
xlsx.mjs
generated
@ -7930,7 +7930,7 @@ var SYLK = /*#__PURE__*/(function() {
|
||||
var sylk_char_fn = function(_, $1){ var o = sylk_escapes[$1]; return typeof o == "number" ? _getansi(o) : o; };
|
||||
var decode_sylk_char = function($$, $1, $2) { var newcc = (($1.charCodeAt(0) - 0x20)<<4) | ($2.charCodeAt(0) - 0x30); return newcc == 59 ? $$ : _getansi(newcc); };
|
||||
sylk_escapes["|"] = 254;
|
||||
/* TODO: find an actual specification */
|
||||
/* https://oss.sheetjs.com/notes/sylk/ for more details */
|
||||
function sylk_to_aoa(d/*:RawData*/, opts)/*:[AOA, Worksheet]*/ {
|
||||
switch(opts.type) {
|
||||
case 'base64': return sylk_to_aoa_str(Base64_decode(d), opts);
|
||||
@ -7946,7 +7946,7 @@ var SYLK = /*#__PURE__*/(function() {
|
||||
var next_cell_format/*:string|null*/ = null;
|
||||
var sht = {}, rowinfo/*:Array<RowInfo>*/ = [], colinfo/*:Array<ColInfo>*/ = [], cw/*:Array<string>*/ = [];
|
||||
var Mval = 0, j;
|
||||
var wb = { Workbook: { WBProps: {} } };
|
||||
var wb = { Workbook: { WBProps: {}, Names: [] } };
|
||||
if(+opts.codepage >= 0) set_cp(+opts.codepage);
|
||||
for (; ri !== records.length; ++ri) {
|
||||
Mval = 0;
|
||||
@ -7965,12 +7965,20 @@ var SYLK = /*#__PURE__*/(function() {
|
||||
if(d1904 >= 1 && d1904 <= 4) wb.Workbook.WBProps.date1904 = true;
|
||||
} break;
|
||||
} break;
|
||||
case 'W': break; /* window? */
|
||||
case 'W': break; /* window */
|
||||
case 'P':
|
||||
if(record[1].charAt(0) == 'P')
|
||||
formats.push(rstr.slice(3).replace(/;;/g, ";"));
|
||||
break;
|
||||
case 'C':
|
||||
case 'NN': { /* defined name */
|
||||
var nn = {Sheet: 0};
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'N': nn.Name = record[rj].slice(1); break;
|
||||
case 'E': nn.Ref = (opts && opts.sheet || "Sheet1") + "!" + rc_to_a1(record[rj].slice(1)); break;
|
||||
}
|
||||
wb.Workbook.Names.push(nn);
|
||||
} break;
|
||||
case 'C': /* cell */
|
||||
var C_seen_K = false, C_seen_X = false, C_seen_S = false, C_seen_E = false, _R = -1, _C = -1;
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'A': break; // TODO: comment
|
||||
@ -8019,7 +8027,7 @@ var SYLK = /*#__PURE__*/(function() {
|
||||
arr[R][C][1] = shift_formula_str(shrbase[1], {r: R - _R, c: C - _C});
|
||||
}
|
||||
break;
|
||||
case 'F':
|
||||
case 'F': /* Format */
|
||||
var F_seen = 0;
|
||||
for(rj=1; rj<record.length; ++rj) switch(record[rj].charAt(0)) {
|
||||
case 'X': C = parseInt(record[rj].slice(1), 10)-1; ++F_seen; break;
|
||||
@ -9436,7 +9444,7 @@ var WK_ = /*#__PURE__*/(function() {
|
||||
break;
|
||||
case 0x02: /* EOF */ break outer;
|
||||
|
||||
/* TODO: The behavior here should be consistent with Numbers: QP Notebook ~ .TN.SheetArchive, QP Sheet ~ .TST.TSTable */
|
||||
/* TODO: The behavior here should be consistent with Numbers: QP Notebook ~ .TN.SheetArchive, QP Sheet ~ .TST.TableModelArchive */
|
||||
case 0x0401: /* BON */ break;
|
||||
case 0x0402: /* EON */ /* TODO: backfill missing sheets based on BON cnt */ break;
|
||||
|
||||
@ -20652,6 +20660,16 @@ var XLSRecordEnum = {
|
||||
/*::[*/0x08cb/*::]*/: { /* n:"CrtCoopt", */ },
|
||||
/*::[*/0x08d6/*::]*/: { /* n:"FRTArchId$", */ r:12 },
|
||||
|
||||
/* --- multiplan 4 records --- */
|
||||
/*::[*/0x0065/*::]*/: { /* n:"", */ }, // one per window
|
||||
/*::[*/0x0066/*::]*/: { /* n:"", */ }, // calc settings
|
||||
/*::[*/0x0069/*::]*/: { /* n:"", */ }, // print header
|
||||
/*::[*/0x006a/*::]*/: { /* n:"", */ }, // print footer
|
||||
/*::[*/0x006b/*::]*/: { /* n:"", */ }, // print settings
|
||||
/*::[*/0x006d/*::]*/: { /* n:"", */ }, // one per window
|
||||
/*::[*/0x0070/*::]*/: { /* n:"", */ }, // includes default col width
|
||||
/*::[*/0x0072/*::]*/: { /* n:"", */ }, // includes selected cell
|
||||
|
||||
/*::[*/0x7262/*::]*/: {}
|
||||
};
|
||||
|
||||
@ -21244,7 +21262,7 @@ function sheet_add_dom(ws/*:Worksheet*/, table/*:HTMLElement*/, _opts/*:?any*/)/
|
||||
if(Aelts && Aelts.length) for(var Aelti = 0; Aelti < Aelts.length; ++Aelti) if(Aelts[Aelti].hasAttribute("href")) {
|
||||
l = Aelts[Aelti].getAttribute("href"); if(l.charAt(0) != "#") break;
|
||||
}
|
||||
if(l && l.charAt(0) != "#") o.l = ({ Target: l });
|
||||
if(l && l.charAt(0) != "#" && l.slice(0, 11).toLowerCase() != 'javascript:') o.l = ({ Target: l });
|
||||
if(opts.dense) { if(!ws[R + or_R]) ws[R + or_R] = []; ws[R + or_R][C + or_C] = o; }
|
||||
else ws[encode_cell({c:C + or_C, r:R + or_R})] = o;
|
||||
if(range.e.c < C + or_C) range.e.c = C + or_C;
|
||||
@ -21284,8 +21302,7 @@ function get_get_computed_style_function(element/*:HTMLElement*/)/*:?function*/
|
||||
// If it is not available, try to get one from the global namespace
|
||||
if(typeof getComputedStyle === 'function') return getComputedStyle;
|
||||
return null;
|
||||
}
|
||||
/* OpenDocument */
|
||||
}/* OpenDocument */
|
||||
function parse_text_p(text/*:string*//*::, tag*/)/*:Array<any>*/ {
|
||||
/* 6.1.2 White Space Characters */
|
||||
var fixed = text
|
||||
@ -24072,6 +24089,11 @@ function readSync(data/*:RawData*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
|
||||
case 0x7B: if(n[1] === 0x5C && n[2] === 0x72 && n[3] === 0x74) return RTF.to_workbook(d, o); break;
|
||||
case 0x0A: case 0x0D: case 0x20: return read_plaintext_raw(d, o);
|
||||
case 0x89: if(n[1] === 0x50 && n[2] === 0x4E && n[3] === 0x47) throw new Error("PNG Image File is not a spreadsheet"); break;
|
||||
case 0x08: if(n[1] === 0xE7) throw new Error("Unsupported Multiplan 1.x file!"); break;
|
||||
case 0x0C:
|
||||
if(n[1] === 0xEC) throw new Error("Unsupported Multiplan 2.x file!");
|
||||
if(n[1] === 0xED) throw new Error("Unsupported Multiplan 3.x file!");
|
||||
break;
|
||||
}
|
||||
if(DBF_SUPPORTED_VERSIONS.indexOf(n[0]) > -1 && n[2] <= 12 && n[3] <= 31) return DBF.to_workbook(d, o);
|
||||
return read_prn(data, d, o, str);
|
||||
|
Loading…
Reference in New Issue
Block a user