updating to 0.13.5

This commit is contained in:
SheetJS 2018-08-25 20:09:59 -04:00
parent d9783acf4a
commit 2e374e3d3a
5 changed files with 70 additions and 28 deletions

@ -133,6 +133,12 @@ var paths = {
dnsxlsx: dir + 'defined_names_simple.xlsx',
dnsxlsb: dir + 'defined_names_simple.xlsb',
dnuxls: dir + 'defined_names_unicode.xls',
dnuxml: dir + 'defined_names_unicode.xml',
dnuods: dir + 'defined_names_unicode.ods',
dnuxlsx: dir + 'defined_names_unicode.xlsx',
dnuxlsb: dir + 'defined_names_unicode.xlsb',
dtxls: dir + 'xlsx-stream-d-date-cell.xls',
dtxml: dir + 'xlsx-stream-d-date-cell.xls.xml',
dtxlsx: dir + 'xlsx-stream-d-date-cell.xlsx',
@ -1154,6 +1160,39 @@ describe('parse features', function() {
assert.equal(names[i].Ref, "Sheet1!$A$2");
}); }); });
describe('defined names unicode', function() {[
/* desc path */
['xlsx', paths.dnuxlsx],
['xlsb', paths.dnuxlsb],
['ods', paths.dnuods ],
['xls', paths.dnuxls ],
['xlml', paths.dnuxml ]
].forEach(function(m) { it(m[0], function() {
var wb = X.read(fs.readFileSync(m[1]), {type:TYPE});
[
"NoContainsJapanese",
"\u65E5\u672C\u8a9e\u306e\u307f",
"sheet\u65e5\u672c\u8a9e",
"\u65e5\u672c\u8a9esheet",
"sheet\u65e5\u672c\u8a9esheet"
].forEach(function(n, i) { assert.equal(wb.SheetNames[i], n); });
[
["name\u65e5\u672c\u8a9e", "sheet\u65e5\u672c\u8a9e!$A$1"],
["name\u65e5\u672c\u8a9ename", "sheet\u65e5\u672c\u8a9esheet!$B$2"],
["NoContainsJapaneseName", "\u65e5\u672c\u8a9e\u306e\u307f!$A$1"],
["sheet\u65e5\u672c\u8a9e", "sheet\u65e5\u672c\u8a9e!$A$1"],
["\u65e5\u672c\u8a9e", "NoContainsJapanese!$A$1"],
["\u65e5\u672c\u8a9ename", "\u65e5\u672c\u8a9esheet!$I$2"]
].forEach(function(n) {
var DN = null;
var arr = wb.Workbook.Names;
for(var j = 0; j < arr.length; ++j) if(arr[j].Name == n[0]) DN = arr[j];
assert(DN);
// $FlowIgnore
assert.equal(DN.Ref, n[1]);
});
}); }); });
describe('auto filter', function() {[
['xlsx', paths.afxlsx],
['xlsb', paths.afxlsb],
@ -1185,7 +1224,7 @@ describe('parse features', function() {
assert.equal(get_cell(wb2.Sheets.Sheet1, "A2").h, "&amp;");
assert.equal(get_cell(wb2.Sheets.Sheet1, "B2").h, "&lt;");
assert.equal(get_cell(wb2.Sheets.Sheet1, "C2").h, "&gt;");
assert.equal(get_cell(wb2.Sheets.Sheet1, "D2").h, "&#x000a;");
assert.equal(get_cell(wb2.Sheets.Sheet1, "D2").h, "<br/>");
}); });
});

File diff suppressed because one or more lines are too long

12
xlsx.core.min.js vendored

File diff suppressed because one or more lines are too long

20
xlsx.full.min.js vendored

File diff suppressed because one or more lines are too long

20
xlsx.js

@ -4,7 +4,7 @@
/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false */
var XLSX = {};
function make_xlsx_lib(XLSX){
XLSX.version = '0.13.4';
XLSX.version = '0.13.5';
var current_codepage = 1200, current_ansi = 1252;
/*global cptable:true, window */
if(typeof module !== "undefined" && typeof require !== 'undefined') {
@ -2191,7 +2191,7 @@ function escapexmltag(text){ return escapexml(text).replace(/ /g,"_x0020_"); }
var htmlcharegex = /[\u0000-\u001f]/g;
function escapehtml(text){
var s = text + '';
return s.replace(decregex, function(y) { return rencoding[y]; }).replace(htmlcharegex,function(s) { return "&#x" + ("000"+s.charCodeAt(0).toString(16)).slice(-4) + ";"; });
return s.replace(decregex, function(y) { return rencoding[y]; }).replace(/\n/g, "<br/>").replace(htmlcharegex,function(s) { return "&#x" + ("000"+s.charCodeAt(0).toString(16)).slice(-4) + ";"; });
}
function escapexlml(text){
@ -13869,13 +13869,13 @@ function parse_wb_xml(data, opts) {
/* 18.2.5 definedName CT_DefinedName + */
case '<definedName': {
dname = {};
dname.Name = y.name;
dname.Name = utf8read(y.name);
if(y.comment) dname.Comment = y.comment;
if(y.localSheetId) dname.Sheet = +y.localSheetId;
dnstart = idx + x.length;
} break;
case '</definedName>': {
dname.Ref = data.slice(dnstart, idx);
dname.Ref = unescapexml(utf8read(data.slice(dnstart, idx)));
wb.Names.push(dname);
} break;
case '<definedName/>': break;
@ -15276,7 +15276,7 @@ function write_ws_xlml_names(ws, opts, idx, wb) {
if(!((wb||{}).Workbook||{}).Names) return "";
var names = wb.Workbook.Names;
var out = [];
outer: for(var i = 0; i < names.length; ++i) {
for(var i = 0; i < names.length; ++i) {
var n = names[i];
if(n.Sheet != idx) continue;
/*switch(n.Name) {
@ -18144,7 +18144,6 @@ var HTML_ = (function() {
function make_html_row(ws, r, R, o) {
var M = (ws['!merges'] ||[]);
var oo = [];
var nullcell = "<td>" + (o.editable ? '<span contenteditable="true"></span>' : "" ) + "</td>";
for(var C = r.s.c; C <= r.e.c; ++C) {
var RS = 0, CS = 0;
for(var j = 0; j < M.length; ++j) {
@ -18156,13 +18155,12 @@ var HTML_ = (function() {
if(RS < 0) continue;
var coord = encode_cell({r:R,c:C});
var cell = o.dense ? (ws[R]||[])[C] : ws[coord];
if(!cell || cell.v == null) { oo.push(nullcell); continue; }
/* TODO: html entities */
var w = cell.h || escapexml(cell.w || (format_cell(cell), cell.w) || "");
var sp = {};
if(RS > 1) sp.rowspan = RS;
if(CS > 1) sp.colspan = CS;
sp.t = cell.t;
/* TODO: html entities */
var w = (cell && cell.v != null) && (cell.h || escapehtml(cell.w || (format_cell(cell), cell.w) || "")) || "";
sp.t = cell && cell.t || 'z';
if(o.editable) w = '<span contenteditable="true">' + w + '</span>';
sp.id = "sjs-" + coord;
oo.push(writextag('td', w, sp));
@ -18348,7 +18346,7 @@ var parse_content_xml = (function() {
}
if(merges.length) ws['!merges'] = merges;
if(rowinfo.length) ws["!rows"] = rowinfo;
sheetag.name = utf8read(sheetag['名称'] || sheetag.name);
sheetag.name = sheetag['名称'] || sheetag.name;
if(typeof JSON !== 'undefined') JSON.stringify(sheetag);
SheetNames.push(sheetag.name);
Sheets[sheetag.name] = ws;