version bump 0.13.5: HTML newlines
- HTML Export emits `<br/>` (fixes #1239 h/t @keithbox) - Unicode Defined Name ODS
This commit is contained in:
parent
d01e10c3f2
commit
eca6b457be
@ -4,6 +4,10 @@ This log is intended to keep track of backwards-incompatible changes, including
|
||||
but not limited to API changes and file location changes. Minor behavioral
|
||||
changes may not be included if they are not expected to break existing code.
|
||||
|
||||
## 0.13.5 (2018-07-25)
|
||||
|
||||
* HTML output generates `<br/>` instead of encoded newline character
|
||||
|
||||
## 0.13.2 (2018-07-08)
|
||||
|
||||
* Buffer.from shim replaced, will not be defined in node `<=0.12`
|
||||
|
@ -1 +1 @@
|
||||
XLSX.version = '0.13.4';
|
||||
XLSX.version = '0.13.5';
|
||||
|
@ -66,7 +66,7 @@ function escapexmltag(text/*:string*/)/*:string*/{ return escapexml(text).replac
|
||||
var htmlcharegex = /[\u0000-\u001f]/g;
|
||||
function escapehtml(text/*:string*/)/*:string*/{
|
||||
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/*:string*/)/*:string*/{
|
||||
|
@ -893,7 +893,7 @@ function write_ws_xlml_names(ws/*:Worksheet*/, opts, idx/*:number*/, wb/*:Workbo
|
||||
/*:: if(!wb || !wb.Workbook || !wb.Workbook.Names) throw new Error("unreachable"); */
|
||||
var names/*:Array<any>*/ = wb.Workbook.Names;
|
||||
var out/*:Array<string>*/ = [];
|
||||
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) {
|
||||
|
@ -58,7 +58,6 @@ var HTML_ = (function() {
|
||||
function make_html_row(ws/*:Worksheet*/, r/*:Range*/, R/*:number*/, o/*:Sheet2HTMLOpts*/)/*:string*/ {
|
||||
var M/*:Array<Range>*/ = (ws['!merges'] ||[]);
|
||||
var oo/*:Array<string>*/ = [];
|
||||
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) {
|
||||
@ -70,13 +69,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));
|
||||
|
@ -69,7 +69,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;
|
||||
|
12
dist/xlsx.core.min.js
generated
vendored
12
dist/xlsx.core.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/xlsx.core.min.map
generated
vendored
2
dist/xlsx.core.min.map
generated
vendored
File diff suppressed because one or more lines are too long
20
dist/xlsx.extendscript.js
generated
vendored
20
dist/xlsx.extendscript.js
generated
vendored
@ -9160,7 +9160,7 @@ module.exports = ZStream;
|
||||
/*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') {
|
||||
@ -11347,7 +11347,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){
|
||||
@ -23025,13 +23025,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;
|
||||
@ -24432,7 +24432,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) {
|
||||
@ -27300,7 +27300,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) {
|
||||
@ -27312,13 +27311,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));
|
||||
@ -27504,7 +27502,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;
|
||||
|
20
dist/xlsx.full.min.js
generated
vendored
20
dist/xlsx.full.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/xlsx.full.min.map
generated
vendored
2
dist/xlsx.full.min.map
generated
vendored
File diff suppressed because one or more lines are too long
20
dist/xlsx.js
generated
vendored
20
dist/xlsx.js
generated
vendored
@ -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;
|
||||
|
16
dist/xlsx.min.js
generated
vendored
16
dist/xlsx.min.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/xlsx.min.map
generated
vendored
2
dist/xlsx.min.map
generated
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xlsx",
|
||||
"version": "0.13.4",
|
||||
"version": "0.13.5",
|
||||
"author": "sheetjs",
|
||||
"description": "SheetJS Spreadsheet data parser and writer",
|
||||
"keywords": [
|
||||
|
41
test.js
41
test.js
@ -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, "&");
|
||||
assert.equal(get_cell(wb2.Sheets.Sheet1, "B2").h, "<");
|
||||
assert.equal(get_cell(wb2.Sheets.Sheet1, "C2").h, ">");
|
||||
assert.equal(get_cell(wb2.Sheets.Sheet1, "D2").h, "
");
|
||||
assert.equal(get_cell(wb2.Sheets.Sheet1, "D2").h, "<br/>");
|
||||
}); });
|
||||
});
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit d1cad393ce43824fcaa31287afd633e2287361b7
|
||||
Subproject commit a4155e4c17fbe2aba8a79ebe6c17d76f4277901e
|
41
tests/core.js
generated
41
tests/core.js
generated
@ -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, "&");
|
||||
assert.equal(get_cell(wb2.Sheets.Sheet1, "B2").h, "<");
|
||||
assert.equal(get_cell(wb2.Sheets.Sheet1, "C2").h, ">");
|
||||
assert.equal(get_cell(wb2.Sheets.Sheet1, "D2").h, "
");
|
||||
assert.equal(get_cell(wb2.Sheets.Sheet1, "D2").h, "<br/>");
|
||||
}); });
|
||||
});
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -57,6 +57,11 @@
|
||||
./test_files/defined_names_simple.xml
|
||||
./test_files/defined_names_simple.xlsx
|
||||
./test_files/defined_names_simple.xlsb
|
||||
./test_files/defined_names_unicode.xls
|
||||
./test_files/defined_names_unicode.xml
|
||||
./test_files/defined_names_unicode.ods
|
||||
./test_files/defined_names_unicode.xlsx
|
||||
./test_files/defined_names_unicode.xlsb
|
||||
./test_files/xlsx-stream-d-date-cell.xls
|
||||
./test_files/xlsx-stream-d-date-cell.xls.xml
|
||||
./test_files/xlsx-stream-d-date-cell.xlsx
|
||||
|
20
xlsx.flow.js
20
xlsx.flow.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;
|
||||
/*:: declare var cptable:any; */
|
||||
/*global cptable:true, window */
|
||||
@ -2269,7 +2269,7 @@ function escapexmltag(text/*:string*/)/*:string*/{ return escapexml(text).replac
|
||||
var htmlcharegex = /[\u0000-\u001f]/g;
|
||||
function escapehtml(text/*:string*/)/*:string*/{
|
||||
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/*:string*/)/*:string*/{
|
||||
@ -13968,13 +13968,13 @@ function parse_wb_xml(data, opts)/*:WorkbookFile*/ {
|
||||
/* 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;
|
||||
@ -15384,7 +15384,7 @@ function write_ws_xlml_names(ws/*:Worksheet*/, opts, idx/*:number*/, wb/*:Workbo
|
||||
/*:: if(!wb || !wb.Workbook || !wb.Workbook.Names) throw new Error("unreachable"); */
|
||||
var names/*:Array<any>*/ = wb.Workbook.Names;
|
||||
var out/*:Array<string>*/ = [];
|
||||
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) {
|
||||
@ -18257,7 +18257,6 @@ var HTML_ = (function() {
|
||||
function make_html_row(ws/*:Worksheet*/, r/*:Range*/, R/*:number*/, o/*:Sheet2HTMLOpts*/)/*:string*/ {
|
||||
var M/*:Array<Range>*/ = (ws['!merges'] ||[]);
|
||||
var oo/*:Array<string>*/ = [];
|
||||
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) {
|
||||
@ -18269,13 +18268,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));
|
||||
@ -18461,7 +18459,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;
|
||||
|
20
xlsx.js
generated
20
xlsx.js
generated
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user