diff --git a/bits/70_xlsx.js b/bits/70_xlsx.js index 12db18d..6e2b7b7 100644 --- a/bits/70_xlsx.js +++ b/bits/70_xlsx.js @@ -103,7 +103,7 @@ function parseSheet(data) { /* 18.3.1.35 dimension CT_SheetDimension ? */ var ref = data.match(//); - if(ref && ref.indexOf(":") !== -1) s["!ref"] = ref[1]; + if(ref && ref.length == 2 && ref[1].indexOf(":") !== -1) s["!ref"] = ref[1]; var refguess = {s: {r:1000000, c:1000000}, e: {r:0, c:0} }; var q = ["v","f"]; @@ -121,9 +121,14 @@ function parseSheet(data) { /* 18.3.1.4 c CT_Cell */ var cells = x.substr(x.indexOf('>')+1).split(/ idx - 1) refguess.s.c = idx - 1; - if(refguess.e.c < idx - 1) refguess.e.c = idx - 1; + if(cref && cref.length == 2) { + var cref_cell = decode_cell(cref[1]); + idx = cref_cell.c; + } + if(refguess.s.c > idx) refguess.s.c = idx; + if(refguess.e.c < idx) refguess.e.c = idx; var cell = parsexmltag((c.match(/]*>/)||[c])[0]); delete cell[0]; var d = c.substr(c.indexOf('>')+1); var p = {}; diff --git a/package.json b/package.json index 6e21f65..c99a6d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xlsx", - "version": "0.2.7-d", + "version": "0.2.8", "author": "Niggler", "description": "(one day) a full-featured XLSX parser and writer. For now, primitive parser", "keywords": [ diff --git a/xlsx.js b/xlsx.js index 89d82ae..257c1db 100644 --- a/xlsx.js +++ b/xlsx.js @@ -533,7 +533,7 @@ function parseSheet(data) { /* 18.3.1.35 dimension CT_SheetDimension ? */ var ref = data.match(//); - if(ref && ref.indexOf(":") !== -1) s["!ref"] = ref[1]; + if(ref && ref.length == 2 && ref[1].indexOf(":") !== -1) s["!ref"] = ref[1]; var refguess = {s: {r:1000000, c:1000000}, e: {r:0, c:0} }; var q = ["v","f"]; @@ -551,9 +551,14 @@ function parseSheet(data) { /* 18.3.1.4 c CT_Cell */ var cells = x.substr(x.indexOf('>')+1).split(/ idx - 1) refguess.s.c = idx - 1; - if(refguess.e.c < idx - 1) refguess.e.c = idx - 1; + if(cref && cref.length == 2) { + var cref_cell = decode_cell(cref[1]); + idx = cref_cell.c; + } + if(refguess.s.c > idx) refguess.s.c = idx; + if(refguess.e.c < idx) refguess.e.c = idx; var cell = parsexmltag((c.match(/]*>/)||[c])[0]); delete cell[0]; var d = c.substr(c.indexOf('>')+1); var p = {};