Merge pull request #2004 from garrettluu/master

Fix sep char recognition for CRLF newline files
This commit is contained in:
Srijon Saha 2020-06-15 10:52:38 -07:00 committed by GitHub
commit c26525d52c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 3 deletions

@ -813,7 +813,17 @@ var PRN = (function() {
var ws/*:Worksheet*/ = o.dense ? ([]/*:any*/) : ({}/*:any*/);
var range/*:Range*/ = ({s: {c:0, r:0}, e: {c:0, r:0}}/*:any*/);
if(str.slice(0,4) == "sep=" && str.charCodeAt(5) == 10) { sep = str.charAt(4); str = str.slice(6); }
if(str.slice(0,4) == "sep=") {
// If the line ends in \r\n
if(str.charCodeAt(5) == 13 && str.charCodeAt(6) == 10 ) {
sep = str.charAt(4); str = str.slice(7);
}
// If line ends in \r OR \n
else if(str.charCodeAt(5) == 13 || str.charCodeAt(5) == 10 ) {
//
sep = str.charAt(4); str = str.slice(6);
}
}
else sep = guess_sep(str.slice(0,1024));
var R = 0, C = 0, v = 0;
var start = 0, end = 0, sepcc = sep.charCodeAt(0), instr = false, cc=0;

@ -7672,7 +7672,17 @@ var PRN = (function() {
var ws/*:Worksheet*/ = o.dense ? ([]/*:any*/) : ({}/*:any*/);
var range/*:Range*/ = ({s: {c:0, r:0}, e: {c:0, r:0}}/*:any*/);
if(str.slice(0,4) == "sep=" && str.charCodeAt(5) == 10) { sep = str.charAt(4); str = str.slice(6); }
if(str.slice(0,4) == "sep=") {
// If the line ends in \r\n
if(str.charCodeAt(5) == 13 && str.charCodeAt(6) == 10 ) {
sep = str.charAt(4); str = str.slice(7);
}
// If line ends in \r OR \n
else if(str.charCodeAt(5) == 13 || str.charCodeAt(5) == 10 ) {
//
sep = str.charAt(4); str = str.slice(6);
}
}
else sep = guess_sep(str.slice(0,1024));
var R = 0, C = 0, v = 0;
var start = 0, end = 0, sepcc = sep.charCodeAt(0), instr = false, cc=0;

12
xlsx.js generated

@ -7574,7 +7574,17 @@ var PRN = (function() {
var ws = o.dense ? ([]) : ({});
var range = ({s: {c:0, r:0}, e: {c:0, r:0}});
if(str.slice(0,4) == "sep=" && str.charCodeAt(5) == 10) { sep = str.charAt(4); str = str.slice(6); }
if(str.slice(0,4) == "sep=") {
// If the line ends in \r\n
if(str.charCodeAt(5) == 13 && str.charCodeAt(6) == 10 ) {
sep = str.charAt(4); str = str.slice(7);
}
// If line ends in \r OR \n
else if(str.charCodeAt(5) == 13 || str.charCodeAt(5) == 10 ) {
//
sep = str.charAt(4); str = str.slice(6);
}
}
else sep = guess_sep(str.slice(0,1024));
var R = 0, C = 0, v = 0;
var start = 0, end = 0, sepcc = sep.charCodeAt(0), instr = false, cc=0;