forked from sheetjs/sheetjs
browser cleanup
utils should not be leaked
This commit is contained in:
parent
0b642080bf
commit
2cdd09f801
@ -1 +1,3 @@
|
|||||||
|
test_files/
|
||||||
|
tests/files/
|
||||||
index.html
|
index.html
|
||||||
|
10
xlsx.js
10
xlsx.js
@ -672,7 +672,7 @@ function parseCT(data) {
|
|||||||
if(!data) return data;
|
if(!data) return data;
|
||||||
var ct = { workbooks: [], sheets: [], calcchains: [], themes: [], styles: [],
|
var ct = { workbooks: [], sheets: [], calcchains: [], themes: [], styles: [],
|
||||||
coreprops: [], extprops: [], strs:[], xmlns: "" };
|
coreprops: [], extprops: [], strs:[], xmlns: "" };
|
||||||
data.match(/<[^>]*>/g).forEach(function(x) {
|
(data.match(/<[^>]*>/g)||[]).forEach(function(x) {
|
||||||
var y = parsexmltag(x);
|
var y = parsexmltag(x);
|
||||||
switch(y[0]) {
|
switch(y[0]) {
|
||||||
case '<?xml': break;
|
case '<?xml': break;
|
||||||
@ -1043,11 +1043,11 @@ function sheet_to_csv(sheet) {
|
|||||||
};
|
};
|
||||||
var out = "";
|
var out = "";
|
||||||
if(sheet["!ref"]) {
|
if(sheet["!ref"]) {
|
||||||
var r = utils.decode_range(sheet["!ref"]);
|
var r = XLSX.utils.decode_range(sheet["!ref"]);
|
||||||
for(var R = r.s.r; R <= r.e.r; ++R) {
|
for(var R = r.s.r; R <= r.e.r; ++R) {
|
||||||
var row = [];
|
var row = [];
|
||||||
for(var C = r.s.c; C <= r.e.c; ++C) {
|
for(var C = r.s.c; C <= r.e.c; ++C) {
|
||||||
var val = sheet[utils.encode_cell({c:C,r:R})];
|
var val = sheet[XLSX.utils.encode_cell({c:C,r:R})];
|
||||||
row.push(val ? stringify(val).replace(/\\r\\n/g,"\n").replace(/\\t/g,"\t").replace(/\\\\/g,"\\").replace("\\\"","\"\"") : "");
|
row.push(val ? stringify(val).replace(/\\r\\n/g,"\n").replace(/\\t/g,"\t").replace(/\\\\/g,"\\").replace("\\\"","\"\"") : "");
|
||||||
}
|
}
|
||||||
out += row.join(",") + "\n";
|
out += row.join(",") + "\n";
|
||||||
@ -1070,7 +1070,7 @@ function get_formulae(ws) {
|
|||||||
return cmds;
|
return cmds;
|
||||||
}
|
}
|
||||||
|
|
||||||
var utils = {
|
XLSX.utils = {
|
||||||
encode_col: encode_col,
|
encode_col: encode_col,
|
||||||
encode_row: encode_row,
|
encode_row: encode_row,
|
||||||
encode_cell: encode_cell,
|
encode_cell: encode_cell,
|
||||||
@ -1089,7 +1089,7 @@ var utils = {
|
|||||||
if(typeof require !== 'undefined' && typeof exports !== 'undefined') {
|
if(typeof require !== 'undefined' && typeof exports !== 'undefined') {
|
||||||
exports.read = XLSX.read;
|
exports.read = XLSX.read;
|
||||||
exports.readFile = XLSX.readFile;
|
exports.readFile = XLSX.readFile;
|
||||||
exports.utils = utils;
|
exports.utils = XLSX.utils;
|
||||||
exports.main = function(args) {
|
exports.main = function(args) {
|
||||||
var zip = XLSX.read(args[0], {type:'file'});
|
var zip = XLSX.read(args[0], {type:'file'});
|
||||||
console.log(zip.Sheets);
|
console.log(zip.Sheets);
|
||||||
|
Loading…
Reference in New Issue
Block a user