version bump 0.2.8: range fix

Fixes #37
This commit is contained in:
SheetJS 2013-10-28 13:28:17 -07:00
parent 2a085af76d
commit 5d79aca2da
3 changed files with 17 additions and 7 deletions

View File

@ -103,7 +103,7 @@ function parseSheet(data) {
/* 18.3.1.35 dimension CT_SheetDimension ? */
var ref = data.match(/<dimension ref="([^"]*)"\s*\/>/);
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(/<c/);
cells.forEach(function(c, idx) { if(c === "" || c.trim() === "") return;
var cref = c.match(/r="([^"]*)"/);
c = "<c" + c;
if(refguess.s.c > 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[^>]*>/)||[c])[0]); delete cell[0];
var d = c.substr(c.indexOf('>')+1);
var p = {};

View File

@ -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": [

11
xlsx.js
View File

@ -533,7 +533,7 @@ function parseSheet(data) {
/* 18.3.1.35 dimension CT_SheetDimension ? */
var ref = data.match(/<dimension ref="([^"]*)"\s*\/>/);
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(/<c/);
cells.forEach(function(c, idx) { if(c === "" || c.trim() === "") return;
var cref = c.match(/r="([^"]*)"/);
c = "<c" + c;
if(refguess.s.c > 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[^>]*>/)||[c])[0]); delete cell[0];
var d = c.substr(c.indexOf('>')+1);
var p = {};