diff --git a/xlsx.js b/xlsx.js
index cb6d199..389e890 100644
--- a/xlsx.js
+++ b/xlsx.js
@@ -1,7 +1,6 @@
/* vim: set ts=2:*/
/*jshint eqnull:true */
var XLSX = (function(){
-var debug = 0;
var ct2type = {
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": "workbooks",
"application/vnd.openxmlformats-package.core-properties+xml": "coreprops",
@@ -96,6 +95,7 @@ function parsexmltag(tag) {
var strs = {}; // shared strings
+/* 18.3 Worksheets */
function parseSheet(data) { //TODO: use a real xml parser
var s = {};
var ref = data.match(//);
@@ -142,8 +142,6 @@ function parseSheet(data) { //TODO: use a real xml parser
});
});
if(!s["!ref"]) s["!ref"] = encode_range(refguess);
-
- if(debug) s.rawdata = data;
return s;
}
@@ -181,6 +179,7 @@ var utf8read = function(orig) {
return out;
};
+/* 18.4 Shared String Table */
function parseStrs(data) {
var s = [];
var sst = data.match(new RegExp("]*)>([\\s\\S]*)<\/sst>","m"));
@@ -190,7 +189,6 @@ function parseStrs(data) {
sst = parsexmltag(sst[1]); s.count = sst.count; s.uniqueCount = sst.uniqueCount;
}
- if(debug) s.rawdata = data;
return s;
}
@@ -224,11 +222,10 @@ function parseProps(data) {
p["LastModifiedBy"] = q["cp:lastModifiedBy"];
p["CreatedDate"] = new Date(q["dcterms:created"]);
p["ModifiedDate"] = new Date(q["dcterms:modified"]);
-
- if(debug) p.rawdata = data;
return p;
}
+/* 18.6 Calculation Chain */
function parseDeps(data) {
var d = [];
var l = 0, i = 1;
@@ -236,11 +233,12 @@ function parseDeps(data) {
var y = parsexmltag(x);
switch(y[0]) {
case '': case '': break;
+ /* 18.6.1 c CT_CalcCell 1 */
case ' 0 ? ct.calcchains[0] : "";
delete ct.calcchains;
- if(debug) ct.rawdata = data;
return ct;
}
+/* 18.2 Workbook */
function parseWB(data) {
var wb = { AppVersion:{}, WBProps:{}, WBView:[], Sheets:[], CalcPr:{}, xmlns: "" };
var pass = false;
@@ -276,31 +274,99 @@ function parseWB(data) {
var y = parsexmltag(x);
switch(y[0]) {
case '': break;
+
+ /* 18.2.13 fileVersion CT_FileVersion ? */
+ case '': break;
+
+ /* 18.2.12 fileSharing CT_FileSharing ? */
+ case '': break;
+
+ /* 18.2.28 workbookPr CT_WorkbookPr ? */
case '': delete y[0]; wb.WBProps = y; break;
- case '': case '': break; // aggregate workbookView
+
+ /* 18.2.29 workbookProtection CT_WorkbookProtection ? */
+ case '': break;
+
+ /* 18.2.1 bookViews CT_BookViews ? */
+ case '': case '': break;
+ /* 18.2.30 workbookView CT_BookView + */
case '': case '': break; // aggregate sheet
+ /* 18.2.19 sheet CT_Sheet + */
case '': case '': break;
- case '': break; // LibreOffice
- case '': break;
- case '': delete y[0]; wb.CalcPr = y; break;
- case '': pass=false; break;
+ /* 18.2.15 functionGroups CT_FunctionGroups ? */
+ case '': break;
+ /* 18.2.14 functionGroup CT_FunctionGroup + */
+ case '': break;
+ /* 18.2.8 externalReference CT_ExternalReference + */
+ case '': break;
case '': pass=true; break;
case '': pass=false; break;
- /* Introduced for Excel2013 Baseline */
- case '': pass=false; break; // TODO: do something
+ /* 18.2.5 definedName CT_DefinedName + */
+ case '': case '': break;
+
+ /* 18.2.2 calcPr CT_CalcPr ? */
+ case '': delete y[0]; wb.CalcPr = y; break;
+
+ /* 18.2.16 oleSize CT_OleSize ? (ref required) */
+ case '': case '': case '': break;
+
+ /* 18.2.18 pivotCaches CT_PivotCaches ? */
+ case '': case '': case '': break;
+
+ /* 18.2.23 smartTagTypes CT_SmartTagTypes ? */
+ case '': case '': break;
+ /* 18.2.22 smartTagType CT_SmartTagType ? */
+ case '': break;
+
+ /* 18.2.11 fileRecoveryPr CT_FileRecoveryPr ? */
+ case '': break;
+
+ /* 18.2.26 webPublishObjects CT_WebPublishObjects ? */
+ case '': case '': break;
+ /* 18.2.25 webPublishObject CT_WebPublishObject ? */
+ case '': case '': case '': break;
+ /* 18.2.7 ext CT_Extension + */
+ case '': pass=false; break;
+
+ /* Others */
+ case '': pass=false; break;
+
default: if(!pass) console.error("WB Tag",x,y);
}
});
@@ -311,7 +377,6 @@ function parseWB(data) {
wb.WBView.forEach(function(w){for(var z in WBViewDef) if(null==w[z]) w[z]=WBViewDef[z]; });
for(z in CalcPrDef) if(null == wb.CalcPr[z]) wb.CalcPr[z] = CalcPrDef[z];
wb.Sheets.forEach(function(w){for(var z in SheetDef) if(null==w[z]) w[z]=SheetDef[z]; });
- if(debug) wb.rawdata = data;
return wb;
}