xlsx
Advanced tools
Comparing version 0.4.3 to 0.5.0
@@ -1,1 +0,1 @@ | ||
XLSX.version = '0.4.3'; | ||
XLSX.version = '0.5.0'; |
@@ -136,3 +136,3 @@ /* Parse a list of <r> tags */ | ||
if(isval(sst)) { | ||
s = sst[2].replace(/<si>/g,"").split(/<\/si>/).map(parse_si).filter(function(x) { return x; }); | ||
s = sst[2].replace(/<(?:si|sstItem)>/g,"").split(/<\/(?:si|sstItem)>/).map(parse_si).filter(function(x) { return x; }); | ||
sst = parsexmltag(sst[1]); s.Count = sst.count; s.Unique = sst.uniqueCount; | ||
@@ -139,0 +139,0 @@ } |
@@ -73,8 +73,3 @@ /* 18.3 Worksheets */ | ||
} | ||
p.raw = p.v; | ||
p.rawt = p.t; | ||
try { | ||
p.v = SSF.format(fmtid,p.v,_ssfopts); | ||
p.t = 'str'; | ||
} catch(e) { p.v = p.raw; p.t = p.rawt; } | ||
try { p.w = SSF.format(fmtid,p.v,_ssfopts); } catch(e) { } | ||
@@ -81,0 +76,0 @@ s[cell.r] = p; |
@@ -1,2 +0,6 @@ | ||
var XMLNS_WB = 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'; | ||
var XMLNS_WB = [ | ||
'http://schemas.openxmlformats.org/spreadsheetml/2006/main', | ||
'http://schemas.microsoft.com/office/excel/2006/main', | ||
'http://schemas.microsoft.com/office/excel/2006/2' | ||
]; | ||
@@ -105,3 +109,3 @@ /* 18.2 Workbook */ | ||
}); | ||
if(wb.xmlns !== XMLNS_WB) throw new Error("Unknown Namespace: " + wb.xmlns); | ||
if(XMLNS_WB.indexOf(wb.xmlns) === -1) throw new Error("Unknown Namespace: " + wb.xmlns); | ||
@@ -108,0 +112,0 @@ var z; |
@@ -19,5 +19,8 @@ function parseZip(zip) { | ||
var wb = parse_wb(getdata(getzipfile(zip, dir.workbooks[0].replace(/^\//,''))), dir.workbooks[0]); | ||
var propdata = dir.coreprops.length !== 0 ? getdata(getzipfile(zip, dir.coreprops[0].replace(/^\//,''))) : ""; | ||
var props = {}, propdata = ""; | ||
try { | ||
propdata = dir.coreprops.length !== 0 ? getdata(getzipfile(zip, dir.coreprops[0].replace(/^\//,''))) : ""; | ||
propdata += dir.extprops.length !== 0 ? getdata(getzipfile(zip, dir.extprops[0].replace(/^\//,''))) : ""; | ||
var props = propdata !== "" ? parseProps(propdata) : {}; | ||
props = propdata !== "" ? parseProps(propdata) : {}; | ||
} catch(e) { } | ||
var deps = {}; | ||
@@ -24,0 +27,0 @@ if(dir.calcchain) deps=parseDeps(getdata(getzipfile(zip, dir.calcchain.replace(/^\//,'')))); |
@@ -23,3 +23,4 @@ var _chr = function(c) { return String.fromCharCode(c); }; | ||
if(!val) continue; | ||
switch(val.t) { | ||
if(val.w) hdr[C] = val.w; | ||
else switch(val.t) { | ||
case 's': case 'str': hdr[C] = val.v; break; | ||
@@ -37,3 +38,3 @@ case 'n': hdr[C] = val.v; break; | ||
if(!val || !val.t) continue; | ||
if(typeof val.w !== 'undefined') { row[hdr[C]] = val.w; isempty = false; } | ||
if(typeof val.w !== 'undefined' && !opts.raw) { row[hdr[C]] = val.w; isempty = false; } | ||
else switch(val.t){ | ||
@@ -40,0 +41,0 @@ case 's': case 'str': case 'b': case 'n': |
{ | ||
"name": "xlsx", | ||
"version": "0.4.3", | ||
"version": "0.5.0", | ||
"author": "sheetjs", | ||
@@ -5,0 +5,0 @@ "description": "XLSB / XLSX / XLSM parser", |
# xlsx | ||
Currently a parser for XLSX/XLSM/XLSB files. Cleanroom implementation from the | ||
Currently a parser for XLSX/XLSM/XLSB files. Cleanroom implementation from the | ||
ISO 29500 Office Open XML specifications, [MS-XLSB], and related documents. | ||
@@ -22,3 +22,3 @@ | ||
See <http://oss.sheetjs.com/js-xlsx/> for a browser example. | ||
See <http://oss.sheetjs.com/js-xlsx/> for a browser example. | ||
@@ -43,7 +43,7 @@ Note that older versions of IE does not support HTML5 File API, so the base64 mode is provided for testing. On OSX you can get the base64 encoding by running: | ||
- `XLSX.utils.sheet_to_csv` generates CSV | ||
- `XLSX.utils.sheet_to_csv` generates CSV | ||
- `XLSX.utils.sheet_to_row_object_array` interprets sheets as tables with a header column and generates an array of objects | ||
- `XLSX.utils.get_formulae` generates a list of formulae | ||
## Notes | ||
## Notes | ||
@@ -53,6 +53,12 @@ `.SheetNames` is an ordered list of the sheets in the workbook | ||
`.Sheets[sheetname]` returns a data structure representing the sheet. Each key | ||
that does not start with `!` corresponds to a cell (using `A-1` notation). | ||
that does not start with `!` corresponds to a cell (using `A-1` notation). | ||
`.Sheets[sheetname][address].v` returns the value of the specified cell and `.Sheets[sheetname][address].t` returns the type of the cell (constrained to the enumeration `ST_CellType` as documented in page 4215 of ISO/IEC 29500-1:2012(E) ) | ||
`.Sheets[sheetname][address]` returns the specified cell: | ||
- `.v` returns the raw value of the cell | ||
- `.w` returns the formatted text of the cell | ||
- `.t` returns the type of the cell (constrained to the enumeration `ST_CellType` as documented in page 4215 of ISO/IEC 29500-1:2012(E) ) | ||
For dates, `.v` holds the raw date code from the sheet and `.w` holds the text | ||
For more details: | ||
@@ -75,3 +81,3 @@ | ||
- <https://travis-ci.org/SheetJS/SheetJS.github.io> for XLS* modules | ||
- <https://saucelabs.com/u/sheetjs> for XLS* modules using Sauce Labs | ||
- <https://saucelabs.com/u/sheetjs> for XLS* modules using Sauce Labs | ||
@@ -82,2 +88,15 @@ ## Test Files | ||
## Testing | ||
`make test` will run the node-based tests. To run the in-browser tests, clone | ||
[the oss.sheetjs.com repo](https://github.com/SheetJS/SheetJS.github.io) and | ||
replace the xlsx.js file (then fire up the browser and go to `stress.html`): | ||
``` | ||
$ cp xlsx.js ../SheetJS.github.io | ||
$ cd ../SheetJS.github.io | ||
$ simplehttpserver # or "python -mSimpleHTTPServer" or "serve" | ||
$ open -a Chromium.app http://localhost:8000/stress.html | ||
``` | ||
## XLS Support | ||
@@ -84,0 +103,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
341696
7715
124