From d5da2eb0171bc96d1bbd87cbc2c90082d4424962 Mon Sep 17 00:00:00 2001 From: SheetJS Date: Wed, 20 Mar 2013 17:30:30 -0400 Subject: [PATCH] version bump 0.1.4 - Handle 'e' error cells (sticking the actual error code in .err, .v undefined) - Added quot and apos to encodings --- package.json | 2 +- xlsx.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 8adbb9e..ee18d08 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xlsx", - "version": "0.1.3", + "version": "0.1.4", "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 079ab73..23cfb5d 100644 --- a/xlsx.js +++ b/xlsx.js @@ -69,6 +69,8 @@ var XMLNS_CT = 'http://schemas.openxmlformats.org/package/2006/content-types'; var XMLNS_WB = 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'; var encodings = { + '"': '"', + ''': "'", '>': '>', '<': '<', '&': '&' @@ -130,6 +132,8 @@ function parseSheet(data) { //TODO: use a real xml parser case '1': case 'TRUE': case "true": case true: p.v=true; break; default: throw "Unrecognized boolean: " + p.v; } break; + /* in case of error, stick value in .err */ + case 'e': p.err = p.v; p.v = undefined; break; default: throw "Unrecognized cell type: " + p.t; } //s.cells[cell.r] = p; @@ -436,6 +440,7 @@ function sheet_to_row_object_array(sheet){ emptyRow = false; } break; + case 'e': break; /* thorw */ default: throw 'unrecognized type ' + val.t; } } @@ -453,6 +458,7 @@ function sheet_to_csv(sheet) { case 'n': return val.v; case 's': case 'str': return JSON.stringify(val.v); case 'b': return val.v ? "TRUE" : "FALSE"; + case 'e': return ""; /* throw out value in case of error */ default: throw 'unrecognized type ' + val.t; } };