Skip to content

Commit 635310b

Browse files
committed
version bump 0.11.3: "array" type
- phased out Array map invocations (fixes SheetJS#620 h/t @dullin) - "array" type supports Uint8Array - Headless browser examples - blank cells are omitted or stubbed (fixes SheetJS#779 h/t @Domxa) - removed transferrables from demo
1 parent 2ea9c95 commit 635310b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1460
-1641
lines changed

.flowconfig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,13 @@
1515

1616
.*/xlsx.js
1717
.*/xlsxworker.js
18-
.*/xlsxworker1.js
19-
.*/xlsxworker2.js
2018
.*/jszip.js
2119
.*/tests/.*
2220
.*/demos/.*
2321

2422
#.*/xlsx.flow.js
2523
[include]
2624
xlsxworker.flow.js
27-
xlsxworker1.flow.js
28-
xlsxworker2.flow.js
2925
xlsx.flow.js
3026
.*/bin/.*.njs
3127
.*/demo/browser.flow.js

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ DEPS=$(sort $(wildcard bits/*.js))
1212
TARGET=$(LIB).js
1313
FLOWTARGET=$(LIB).flow.js
1414
FLOWAUX=$(patsubst %.js,%.flow.js,$(AUXTARGETS))
15-
AUXSCPTS=xlsxworker1.js xlsxworker2.js xlsxworker.js
15+
AUXSCPTS=xlsxworker.js
1616
FLOWTGTS=$(TARGET) $(AUXTARGETS) $(AUXSCPTS)
1717
UGLIFYOPTS=--support-ie8 -m
1818
CLOSURE=/usr/local/lib/node_modules/google-closure-compiler/compiler.jar

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ The `demos` directory includes sample projects for:
182182

183183
**JS Platforms and Integrations**
184184
- [`Adobe ExtendScript`](demos/extendscript/)
185-
- [`phantomjs`](demos/phantomjs/)
185+
- [`Headless Browsers`](demos/headless/)
186186
- [`canvas-datagrid`](demos/datagrid/)
187187
- [`Other JS engines`](demos/altjs/)
188188

@@ -1430,7 +1430,7 @@ tells the library how to parse the data argument:
14301430
| `type` | expected input |
14311431
|------------|-----------------------------------------------------------------|
14321432
| `"base64"` | string: base64 encoding of the file |
1433-
| `"binary"` | string: binary string (`n`-th byte is `data.charCodeAt(n)`) |
1433+
| `"binary"` | string: binary string (`n`-th byte is `data.charCodeAt(n)`) |
14341434
| `"buffer"` | nodejs Buffer |
14351435
| `"array"` | array: array of 8-bit unsigned int (`n`-th byte is `data[n]`) |
14361436
| `"file"` | string: filename that will be read and processed (nodejs only) |
@@ -1456,7 +1456,7 @@ file but Excel will know how to handle it. This library applies similar logic:
14561456
| `0xEF` | UTF8 Encoded | SpreadsheetML / Flat ODS / UOS1 / HTML / plaintext |
14571457
| `0xFF` | UTF16 Encoded | SpreadsheetML / Flat ODS / UOS1 / HTML / plaintext |
14581458
| `0x00` | Record Stream | Lotus WK\* or Quattro Pro or plaintext |
1459-
| `0x0A` | Plaintext | RTF or plaintext |
1459+
| `0x7B` | Plaintext | RTF or plaintext |
14601460
| `0x0A` | Plaintext | SpreadsheetML / Flat ODS / UOS1 / HTML / plaintext |
14611461
| `0x0D` | Plaintext | SpreadsheetML / Flat ODS / UOS1 / HTML / plaintext |
14621462
| `0x20` | Plaintext | SpreadsheetML / Flat ODS / UOS1 / HTML / plaintext |

bits/01_version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
XLSX.version = '0.11.2';
1+
XLSX.version = '0.11.3';

bits/23_binutils.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ var __toBuffer, ___toBuffer;
2828
__toBuffer = ___toBuffer = function toBuffer_(bufs) { var x = []; for(var i = 0; i < bufs[0].length; ++i) { x.push.apply(x, bufs[0][i]); } return x; };
2929
var __utf16le, ___utf16le;
3030
__utf16le = ___utf16le = function utf16le_(b,s,e) { var ss=[]; for(var i=s; i<e; i+=2) ss.push(String.fromCharCode(__readUInt16LE(b,i))); return ss.join(""); };
31-
var __hexlify, ___hexlify;
32-
__hexlify = ___hexlify = function hexlify_(b,s,l) { return b.slice(s,(s+l)).map(function(x){return (x<16?"0":"") + x.toString(16);}).join(""); };
31+
var __hexlify = function(b/*:RawBytes|CFBlob*/,s/*:number*/,l/*:number*/)/*:string*/ { var ss/*:Array<string>*/=[]; for(var i=s; i<s+l; ++i) ss.push(("0" + b[i].toString(16)).slice(-2)); return ss.join(""); };
32+
var ___hexlify = __hexlify;
3333
var __utf8, ___utf8;
3434
__utf8 = ___utf8 = function(b,s,e) { var ss=[]; for(var i=s; i<e; i++) ss.push(String.fromCharCode(__readUInt8(b,i))); return ss.join(""); };
3535
var __lpstr, ___lpstr;
@@ -68,11 +68,11 @@ if(typeof cptable !== 'undefined') {
6868
__8lpp4 = function(b,i) { var len = __readUInt32LE(b,i); return len > 0 ? cptable.utils.decode(65001, b.slice(i+4,i+4+len)) : "";};
6969
}
7070

71-
var __readUInt8 = function(b, idx) { return b[idx]; };
72-
var __readUInt16LE = function(b, idx) { return b[idx+1]*(1<<8)+b[idx]; };
73-
var __readInt16LE = function(b, idx) { var u = b[idx+1]*(1<<8)+b[idx]; return (u < 0x8000) ? u : (0xffff - u + 1) * -1; };
74-
var __readUInt32LE = function(b, idx) { return b[idx+3]*(1<<24)+(b[idx+2]<<16)+(b[idx+1]<<8)+b[idx]; };
75-
var __readInt32LE = function(b, idx) { return (b[idx+3]<<24)|(b[idx+2]<<16)|(b[idx+1]<<8)|b[idx]; };
71+
var __readUInt8 = function(b, idx/*:number*/)/*:number*/ { return b[idx]; };
72+
var __readUInt16LE = function(b, idx/*:number*/)/*:number*/ { return b[idx+1]*(1<<8)+b[idx]; };
73+
var __readInt16LE = function(b, idx/*:number*/)/*:number*/ { var u = b[idx+1]*(1<<8)+b[idx]; return (u < 0x8000) ? u : (0xffff - u + 1) * -1; };
74+
var __readUInt32LE = function(b, idx/*:number*/)/*:number*/ { return b[idx+3]*(1<<24)+(b[idx+2]<<16)+(b[idx+1]<<8)+b[idx]; };
75+
var __readInt32LE = function(b, idx/*:number*/)/*:number*/ { return (b[idx+3]<<24)|(b[idx+2]<<16)|(b[idx+1]<<8)|b[idx]; };
7676

7777
var ___unhexlify = function(s) { return s.match(/../g).map(function(x) { return parseInt(x,16);}); };
7878
var __unhexlify = typeof Buffer !== "undefined" ? function(s) { return Buffer.isBuffer(s) ? new Buffer(s, 'hex') : ___unhexlify(s); } : ___unhexlify;

bits/40_harb.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,8 @@ var PRN = (function() {
518518
if((cc=str.charCodeAt(end)) == 0x22) instr = !instr;
519519
else if(!instr) cnt[cc] = (cnt[cc]||0)+1;
520520
}
521-
if(cnt[0x2C] > cnt[0x09]) return ",";
522-
return ",";
521+
if((cnt[0x2C]||0) >= (cnt[0x09]||0)) return ",";
522+
return "\t";
523523
}
524524

525525
function dsv_to_sheet_str(str/*:string*/, opts)/*:Worksheet*/ {

bits/53_ccbin.js renamed to bits/52_calcchain.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
/* 18.6 Calculation Chain */
2+
function parse_cc_xml(data, name, opts) {
3+
var d = [];
4+
if(!data) return d;
5+
var l = 0, i = 1;
6+
(data.match(tagregex)||[]).forEach(function(x) {
7+
var y = parsexmltag(x);
8+
switch(y[0]) {
9+
case '<?xml': break;
10+
/* 18.6.2 calcChain CT_CalcChain 1 */
11+
case '<calcChain': case '<calcChain>': case '</calcChain>': break;
12+
/* 18.6.1 c CT_CalcCell 1 */
13+
case '<c': delete y[0]; if(y.i) i = y.i; else y.i = i; d.push(y); break;
14+
}
15+
});
16+
return d;
17+
}
18+
19+
function write_cc_xml(data, opts) { }
20+
121
/* [MS-XLSB] 2.6.4.1 */
222
function parse_BrtCalcChainItem$(data, length) {
323
var out = {};
@@ -13,7 +33,7 @@ function parse_BrtCalcChainItem$(data, length) {
1333
}
1434

1535
/* 18.6 Calculation Chain */
16-
function parse_cc_bin(data, opts) {
36+
function parse_cc_bin(data, name, opts) {
1737
var out = [];
1838
var pass = false;
1939
recordhopper(data, function hopper_cc(val, R_n, RT) {

bits/52_ccxml.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

bits/53_externlink.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/* 18.14 Supplementary Workbook Data */
2+
function parse_xlink_xml(data, name/*:string*/, _opts) {
3+
var opts = _opts || {};
4+
//if(opts.WTF) throw "XLSX External Link";
5+
}
6+
7+
/* [MS-XLSB] 2.1.7.25 External Link */
8+
function parse_xlink_bin(data, name/*:string*/, _opts) {
9+
if(!data) return data;
10+
var opts = _opts || {};
11+
12+
var pass = false, end = false;
13+
14+
recordhopper(data, function xlink_parse(val, R_n, RT) {
15+
if(end) return;
16+
switch(RT) {
17+
case 0x0167: /* 'BrtSupTabs' */
18+
case 0x016B: /* 'BrtExternTableStart' */
19+
case 0x016C: /* 'BrtExternTableEnd' */
20+
case 0x016E: /* 'BrtExternRowHdr' */
21+
case 0x016F: /* 'BrtExternCellBlank' */
22+
case 0x0170: /* 'BrtExternCellReal' */
23+
case 0x0171: /* 'BrtExternCellBool' */
24+
case 0x0172: /* 'BrtExternCellError' */
25+
case 0x0173: /* 'BrtExternCellString' */
26+
case 0x01D8: /* 'BrtExternValueMeta' */
27+
case 0x0241: /* 'BrtSupNameStart' */
28+
case 0x0242: /* 'BrtSupNameValueStart' */
29+
case 0x0243: /* 'BrtSupNameValueEnd' */
30+
case 0x0244: /* 'BrtSupNameNum' */
31+
case 0x0245: /* 'BrtSupNameErr' */
32+
case 0x0246: /* 'BrtSupNameSt' */
33+
case 0x0247: /* 'BrtSupNameNil' */
34+
case 0x0248: /* 'BrtSupNameBool' */
35+
case 0x0249: /* 'BrtSupNameFmla' */
36+
case 0x024A: /* 'BrtSupNameBits' */
37+
case 0x024B: /* 'BrtSupNameEnd' */
38+
break;
39+
40+
case 0x0023: /* 'BrtFRTBegin' */
41+
pass = true; break;
42+
case 0x0024: /* 'BrtFRTEnd' */
43+
pass = false; break;
44+
45+
default:
46+
if((R_n||"").indexOf("Begin") > 0){/* empty */}
47+
else if((R_n||"").indexOf("End") > 0){/* empty */}
48+
else if(!pass || opts.WTF) throw new Error("Unexpected record " + RT.toString(16) + " " + R_n);
49+
}
50+
}, opts);
51+
}

bits/62_fxls.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ function stringify_formula(formula/*Array<any>*/, range, cell/*:any*/, supbooks,
823823
case 'PtgArea3d': /* 2.5.198.28 TODO */
824824
type = f[1][0]; ixti = /*::Number(*/f[1][1]/*::)*/; r = f[1][2];
825825
sname = (supbooks && supbooks[1] ? supbooks[1][ixti+1] : "**MISSING**");
826-
stack.push(sname + "!" + encode_range((r/*:any*/)));
826+
stack.push(sname + "!" + encode_range_xls((r/*:any*/), opts));
827827
break;
828828
case 'PtgAttrSum': /* 2.5.198.41 */
829829
stack.push("SUM(" + stack.pop() + ")");

0 commit comments

Comments
 (0)