forked from sheetjs/sheetjs
		
	version bump 0.5.10: numbers iOS fix
Most writers write sheets to xl/worksheets/sheetN.xml (where N is 1-indexed) Numbers for iOS apparently writes to xl/worksheets/sheet.xml (for first sheet) xl/worksheets/sheetN.xml (N>1, 0-indexed -- sheet1.xml corresponds to 2nd sheet) The right thing to do is to dig into workbook rels, but that's for another day
This commit is contained in:
		
							parent
							
								
									c300e24009
								
							
						
					
					
						commit
						ad20bf9b83
					
				| @ -1 +1 @@ | ||||
| XLSX.version = '0.5.9'; | ||||
| XLSX.version = '0.5.10'; | ||||
|  | ||||
| @ -2,7 +2,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) */ | ||||
|  | ||||
| @ -63,24 +63,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); | ||||
| @ -97,8 +91,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; | ||||
| } | ||||
|  | ||||
							
								
								
									
										38
									
								
								dist/xlsx.js
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										38
									
								
								dist/xlsx.js
									
									
									
									
										vendored
									
									
								
							| @ -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; | ||||
| } | ||||
|  | ||||
							
								
								
									
										4
									
								
								dist/xlsx.min.js
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										4
									
								
								dist/xlsx.min.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										2
									
								
								dist/xlsx.min.map
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										2
									
								
								dist/xlsx.min.map
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -1,6 +1,6 @@ | ||||
| { | ||||
| 	"name": "xlsx", | ||||
| 	"version": "0.5.9", | ||||
| 	"version": "0.5.10", | ||||
| 	"author": "sheetjs", | ||||
| 	"description": "XLSB / XLSX / XLSM parser", | ||||
| 	"keywords": [ "xlsx", "xlsb", "xlsm", "office", "excel", "spreadsheet" ], | ||||
|  | ||||
							
								
								
									
										38
									
								
								xlsx.js
									
									
									
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										38
									
								
								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; | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user