Comparing version 0.6.0 to 0.6.1
@@ -1,1 +0,1 @@ | ||
XLSX.version = '0.6.0'; | ||
XLSX.version = '0.6.1'; |
@@ -108,3 +108,3 @@ /* ssf.js (C) 2013-2014 SheetJS -- http://sheetjs.com */ | ||
o = v.toFixed(11).replace(/(\.[0-9]*[1-9])0*$/,"$1"); | ||
if(o.length > 11 + (v<0?1:0)) o = v.toPrecision(6); | ||
if(o.length > 11 + (v<0?1:0)) o = v.toPrecision(6); | ||
} | ||
@@ -221,3 +221,3 @@ o = o.replace(/(\.[0-9]*[1-9])0+e/,"$1e").replace(/\.0*e/,"e"); | ||
if(fmt.match(/^#+0.0E\+0$/)) { | ||
var period = fmt.indexOf("."); if(period === -1) period=fmt.indexOf('E'); | ||
var period = fmt.indexOf("."); if(period === -1) period=fmt.indexOf('E'); | ||
var ee = (Number(val.toExponential(0).substr(2+(val<0))))%period; | ||
@@ -224,0 +224,0 @@ if(ee < 0) ee += period; |
@@ -0,1 +1,25 @@ | ||
/* 18.4.1 charset to codepage mapping */ | ||
var CS2CP = { | ||
0: 1252, /* ANSI */ | ||
1: 65001, /* DEFAULT */ | ||
2: 65001, /* SYMBOL */ | ||
77: 10000, /* MAC */ | ||
128: 932, /* SHIFTJIS */ | ||
129: 949, /* HANGUL */ | ||
130: 1361, /* JOHAB */ | ||
134: 936, /* GB2312 */ | ||
136: 950, /* CHINESEBIG5 */ | ||
161: 1253, /* GREEK */ | ||
162: 1254, /* TURKISH */ | ||
163: 1258, /* VIETNAMESE */ | ||
177: 1255, /* HEBREW */ | ||
178: 1256, /* ARABIC */ | ||
186: 1257, /* BALTIC */ | ||
204: 1251, /* RUSSIAN */ | ||
222: 874, /* THAI */ | ||
238: 1250, /* EASTEUROPE */ | ||
255: 1252, /* OEM */ | ||
69: 6969 /* MISC */ | ||
}; | ||
/* Parse a list of <r> tags */ | ||
@@ -6,3 +30,3 @@ var parse_rs = (function() { | ||
var parse_rpr = function(rpr, intro, outro) { | ||
var font = {}; | ||
var font = {}, cp = 65001; | ||
(rpr.match(/<[^>]*>/g)||[]).forEach(function(x) { | ||
@@ -24,3 +48,6 @@ var y = parsexmltag(x); | ||
/* 18.4.1 charset CT_IntProperty TODO */ | ||
case '<charset': break; | ||
case '<charset': | ||
if(y.val == '1') break; | ||
cp = CS2CP[parseInt(y.val, 10)]; | ||
break; | ||
@@ -90,2 +117,3 @@ /* 18.4.2 outline CT_BooleanProperty TODO */ | ||
outro.push("</span>"); | ||
return cp; | ||
}; | ||
@@ -97,3 +125,3 @@ | ||
/* 18.4.12 t ST_Xstring */ | ||
var t = r.match(tregex); | ||
var t = r.match(tregex), cp = 65001; | ||
if(!isval(t)) return ""; | ||
@@ -103,3 +131,4 @@ terms[1] = t[1]; | ||
var rpr = r.match(rpregex); | ||
if(isval(rpr)) parse_rpr(rpr[1], terms[0], terms[2]); | ||
if(isval(rpr)) cp = parse_rpr(rpr[1], terms[0], terms[2]); | ||
return terms[0].join("") + terms[1].replace(/\r\n/g,'<br/>') + terms[2].join(""); | ||
@@ -106,0 +135,0 @@ } |
@@ -10,3 +10,3 @@ /* 18.8.31 numFmts CT_NumFmts */ | ||
case '<numFmt': { | ||
var f=unescapexml(y.formatCode), i=parseInt(y.numFmtId,10); | ||
var f=utf8read(unescapexml(y.formatCode)), i=parseInt(y.numFmtId,10); | ||
styles.NumberFmt[i] = f; if(i>0) SSF.load(f,i); | ||
@@ -13,0 +13,0 @@ } break; |
{ | ||
"name": "xlsx", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"author": "sheetjs", | ||
@@ -13,5 +13,5 @@ "description": "XLSB / XLSX / XLSM (Excel 2007+ Spreadsheet) parser", | ||
"ssf":"~0.6.4", | ||
"codepage":"", | ||
"codepage":"1.x", | ||
"cfb":"", | ||
"jszip":"~2.1.0", | ||
"jszip":"~2.2.0", | ||
"commander":"" | ||
@@ -27,3 +27,3 @@ }, | ||
"pretest": "git submodule init && git submodule update", | ||
"test": "make mocha", | ||
"test": "make test", | ||
"test-jasmine": "jasmine-node --verbose tests/" | ||
@@ -30,0 +30,0 @@ }, |
@@ -14,2 +14,14 @@ # xlsx | ||
<!-- This is the only file you need (includes xlsx.js and jszip) --> | ||
<script lang="javascript" src="dist/xlsx.core.min.js"></script> | ||
In [bower](http://bower.io/): | ||
bower install js-xlsx | ||
CDNjs automatically pulls the latest version and makes all versions available at | ||
<http://cdnjs.com/libraries/xlsx> | ||
Older versions of this README recommended a more explicit approach: | ||
<!-- JSZip must be included before xlsx.js --> | ||
@@ -19,2 +31,13 @@ <script lang="javascript" src="/path/to/jszip.js"></script> | ||
## Optional Modules | ||
The node version automatically requires modules for additional features. Some of these modules are rather large in size and are only needed in special circumstances, so they do not ship with the core. For browser use, they must be included directly: | ||
<!-- international support from https://github.com/sheetjs/js-codepage --> | ||
<script src="dist/cpexcel.js"></script> | ||
An appropriate version for each dependency is included in the dist/ directory. | ||
The complete single-file version is generated at `dist/xlsx.full.min.js` | ||
## Usage | ||
@@ -24,9 +47,10 @@ | ||
var XLSX = require('xlsx') | ||
var xlsx = XLSX.readFile('test.xlsx'); | ||
var XLSX = require('xlsx'); | ||
var workbook = XLSX.readFile('test.xlsx'); | ||
var sheet_name_list = xlsx.SheetNames; | ||
xlsx.SheetNames.forEach(function(y) { | ||
for (z in xlsx.Sheets[y]) { | ||
sheet_name_list.forEach(function(y) { | ||
var worksheet = workbook.Sheets[y]; | ||
for (z in worksheet) { | ||
if(z[0] === '!') continue; | ||
console.log(y + "!" + z + "=" + JSON.stringify(xlsx.Sheets[y][z].v)); | ||
console.log(y + "!" + z + "=" + JSON.stringify(worksheet[z].v)); | ||
} | ||
@@ -33,0 +57,0 @@ }); |
@@ -301,3 +301,3 @@ /* vim: set ts=2: */ | ||
assert.equal(ws.B1.c[0].a, "Yegor Kozlov","must have the same author"); | ||
assert.equal(ws.B1.c[0].t.replace(/\r\n/g,"\n"), "Yegor Kozlov:\nfirst cell", "must have the concatenated texts"); | ||
assert.equal(ws.B1.c[0].t.replace(/\r\n/g,"\n").replace(/\r/g,"\n"), "Yegor Kozlov:\nfirst cell", "must have the concatenated texts"); | ||
if(i > 0) return; | ||
@@ -304,0 +304,0 @@ assert.equal(ws.B1.c[0].r, '<r><rPr><b/><sz val="8"/><color indexed="81"/><rFont val="Tahoma"/></rPr><t>Yegor Kozlov:</t></r><r><rPr><sz val="8"/><color indexed="81"/><rFont val="Tahoma"/></rPr><t xml:space="preserve">\r\nfirst cell</t></r>', "must have the rich text representation"); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
High entropy strings
Supply chain riskContains high entropy strings. This could be a sign of encrypted data, leaked secrets or obfuscated code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
2349942
71
20094
2
191
5
38
+ Addedjszip@2.2.2(transitive)
+ Addedpako@0.2.9(transitive)
- Removedjszip@2.1.1(transitive)
- Removedzlibjs@0.1.8(transitive)
Updatedcodepage@1.x
Updatedjszip@~2.2.0