From f69622550eaee6574e845b6424a4c9d34ab06dce Mon Sep 17 00:00:00 2001 From: SheetJS Date: Fri, 21 Feb 2014 11:50:59 -0500 Subject: [PATCH] updating to 0.5.10 --- xlsx.js | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/xlsx.js b/xlsx.js index 1078f48..b3c6fac 100644 --- a/xlsx.js +++ b/xlsx.js @@ -423,7 +423,7 @@ SSF.load_table = function(tbl) { for(var i=0; i!=0x0188; ++i) if(tbl[i]) SSF.loa make_ssf(SSF); var XLSX = {}; (function(XLSX){ -XLSX.version = '0.5.9'; +XLSX.version = '0.5.10'; var current_codepage, current_cptable, cptable; if(typeof module !== "undefined" && typeof require !== 'undefined') { if(typeof cptable === 'undefined') cptable = require('codepage'); @@ -2730,7 +2730,7 @@ function fixopts(opts) { var defaults = [ ['cellNF', false], /* emit cell number format string as .z */ ['cellHTML', true], /* emit html string as .h */ - ['cellFormula', true], /* emit formulae as .h */ + ['cellFormula', true], /* emit formulae as .f */ ['sheetStubs', false], /* emit empty cells */ ['sheetRows', 0, 'n'], /* read n rows (0 = read all rows) */ @@ -2811,24 +2811,18 @@ function parseZip(zip, opts) { for(var j = 0; j != wbsheets.length; ++j) { props.SheetNames[j] = wbsheets[j].name; } - for(i = 0; i != props.Worksheets; ++i) { - try { - path = 'xl/worksheets/sheet' + (i+1) + (xlsb?'.bin':'.xml'); - relsPath = path.replace(/^(.*)(\/)([^\/]*)$/, "$1/_rels/$3.rels"); - sheets[props.SheetNames[i]]=parse_ws(getzipdata(zip, path),path,opts); - sheetRels[props.SheetNames[i]]=parseRels(getzipdata(zip, relsPath, true), path); - } catch(e) { if(opts.WTF) throw e; } - } - } else { - for(i = 0; i != props.Worksheets; ++i) { - try { - //var path = dir.sheets[i].replace(/^\//,''); - path = 'xl/worksheets/sheet' + (i+1) + (xlsb?'.bin':'.xml'); - relsPath = path.replace(/^(.*)(\/)([^\/]*)$/, "$1/_rels/$3.rels"); - sheets[props.SheetNames[i]]=parse_ws(getzipdata(zip, path),path,opts); - sheetRels[props.SheetNames[i]]=parseRels(getzipdata(zip, relsPath, true), path); - } catch(e) { if(opts.WTF) throw e; } - } + } + /* Numbers iOS hack TODO: parse workbook rels to get names */ + var nmode = (getzipdata(zip,"xl/worksheets/sheet.xml",true))?1:0; + for(i = 0; i != props.Worksheets; ++i) { + try { + //path = dir.sheets[i].replace(/^\//,''); + path = 'xl/worksheets/sheet'+(i+1-nmode)+(xlsb?'.bin':'.xml'); + path = path.replace(/sheet0\./,"sheet."); + relsPath = path.replace(/^(.*)(\/)([^\/]*)$/, "$1/_rels/$3.rels"); + sheets[props.SheetNames[i]]=parse_ws(getzipdata(zip, path),path,opts); + sheetRels[props.SheetNames[i]]=parseRels(getzipdata(zip, relsPath, true), path); + } catch(e) { if(opts.WTF) throw e; } } if(dir.comments) parse_comments(zip, dir.comments, sheets, sheetRels, opts); @@ -2845,8 +2839,8 @@ function parseZip(zip, opts) { Styles: styles, }; if(opts.bookFiles) { - out.keys = keys, - out.files = zip.files + out.keys = keys; + out.files = zip.files; } return out; }