1
Fork 0

version bump 0.15.3: Thanksgiving edition

Proper XML Encoding of Props/CustProps (fixes #1690 h/t @karlbecker)
This commit is contained in:
SheetJS 2019-11-27 04:47:16 -05:00
parent 7e932aec00
commit 7ef3f3e531
22 changed files with 117 additions and 101 deletions

View File

@ -1,4 +1,5 @@
test_files/
packages/
.github/
tests/files/
demos/

View File

@ -10,23 +10,24 @@ node_js:
- "6"
matrix:
include:
- node_js: "6"
env: TZ="America/New_York" FMTS=misc
- node_js: "8"
env: TZ="America/Los_Angeles"
- node_js: "8"
env: TZ="Europe/London" FMTS=misc
- node_js: "6"
env: TZ="Europe/Berlin"
- node_js: "6"
env: TZ="Asia/Kolkata" FMTS=misc
- node_js: "12"
env: TZ="America/New_York"
- node_js: "12"
env: TZ="Europe/London"
- node_js: "12"
env: TZ="Asia/Seoul"
- node_js: "11"
env: TZ="America/Los_Angeles" FMTS=misc
- node_js: "10"
env: TZ="Europe/Berlin" FMTS=misc
- node_js: "9"
env: TZ="Asia/Shanghai"
env: TZ="Asia/Kolkata" FMTS=misc
- node_js: "8"
env: TZ="Asia/Seoul" FMTS=misc
env: TZ="Asia/Shanghai" FMTS=misc
- node_js: "7"
env: TZ="America/Cancun" FMTS=misc
- node_js: "6"
env: TZ="Asia/Seoul" FMTS=misc
- node_js: "5"
env: TZ="America/Anchorage" FMTS=misc
- node_js: "4"

View File

@ -1 +1 @@
XLSX.version = '0.15.2';
XLSX.version = '0.15.3';

View File

@ -227,8 +227,8 @@ function write_w3cdtf(d/*:Date*/, t/*:?boolean*/)/*:string*/ { try { return d.to
function write_vt(s)/*:string*/ {
switch(typeof s) {
case 'string': return writextag('vt:lpwstr', s);
case 'number': return writextag((s|0)==s?'vt:i4':'vt:r8', String(s));
case 'string': return writextag('vt:lpwstr', escapexml(s));
case 'number': return writextag((s|0)==s?'vt:i4':'vt:r8', escapexml(String(s)));
case 'boolean': return writextag('vt:bool',s?'true':'false');
}
if(s instanceof Date) return writextag('vt:filetime', write_w3cdtf(s));

View File

@ -37,7 +37,7 @@ function parse_core_props(data) {
for(var i = 0; i < CORE_PROPS.length; ++i) {
var f = CORE_PROPS[i], cur = data.match(CORE_PROPS_REGEX[i]);
if(cur != null && cur.length > 0) p[f[1]] = cur[1];
if(cur != null && cur.length > 0) p[f[1]] = unescapexml(cur[1]);
if(f[2] === 'date' && p[f[1]]) p[f[1]] = parseDate(p[f[1]]);
}
@ -56,6 +56,7 @@ var CORE_PROPS_XML_ROOT = writextag('cp:coreProperties', null, {
function cp_doit(f, g, h, o, p) {
if(p[f] != null || g == null || g === "") return;
p[f] = g;
g = escapexml(g);
o[o.length] = (h ? writextag(f,g,h) : writetag(f,g));
}

View File

@ -74,9 +74,10 @@ function parse_ext_props(data, p, opts) {
data = utf8read(data);
EXT_PROPS.forEach(function(f) {
var xml = (data.match(matchtag(f[0]))||[])[1];
switch(f[2]) {
case "string": p[f[1]] = (data.match(matchtag(f[0]))||[])[1]; break;
case "bool": p[f[1]] = (data.match(matchtag(f[0]))||[])[1] === "true"; break;
case "string": p[f[1]] = unescapexml(xml||""); break;
case "bool": p[f[1]] = xml === "true"; break;
case "raw":
var cur = data.match(new RegExp("<" + f[0] + "[^>]*>([\\s\\S]*?)<\/" + f[0] + ">"));
if(cur && cur.length > 0) q[f[1]] = cur[1];
@ -105,7 +106,7 @@ function write_ext_props(cp/*::, opts*/)/*:string*/ {
if(cp[f[1]] === undefined) return;
var v;
switch(f[2]) {
case 'string': v = String(cp[f[1]]); break;
case 'string': v = escapexml(String(cp[f[1]])); break;
case 'bool': v = cp[f[1]] ? 'true' : 'false'; break;
}
if(v !== undefined) o[o.length] = (W(f[0], v));

View File

@ -11,7 +11,7 @@ function parse_cust_props(data/*:string*/, opts) {
switch(y[0]) {
case '<?xml': break;
case '<Properties': break;
case '<property': name = y.name; break;
case '<property': name = unescapexml(y.name); break;
case '</property>': name = null; break;
default: if (x.indexOf('<vt:') === 0) {
var toks = x.split('>');
@ -60,7 +60,7 @@ function write_cust_props(cp/*::, opts*/)/*:string*/ {
o[o.length] = (writextag('property', write_vt(cp[k]), {
'fmtid': '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}',
'pid': pid,
'name': k
'name': escapexml(k)
}));
});
if(o.length>2){ o[o.length] = '</Properties>'; o[1]=o[1].replace("/>",">"); }

6
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

File diff suppressed because one or more lines are too long

20
dist/xlsx.extendscript.js generated vendored
View File

@ -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.15.2';
XLSX.version = '0.15.3';
var current_codepage = 1200, current_ansi = 1252;
/*global cptable:true, window */
if(typeof module !== "undefined" && typeof require !== 'undefined') {
@ -12270,8 +12270,8 @@ function write_w3cdtf(d, t) { try { return d.toISOString().replace(/\.\d*/,"");
function write_vt(s) {
switch(typeof s) {
case 'string': return writextag('vt:lpwstr', s);
case 'number': return writextag((s|0)==s?'vt:i4':'vt:r8', String(s));
case 'string': return writextag('vt:lpwstr', escapexml(s));
case 'number': return writextag((s|0)==s?'vt:i4':'vt:r8', escapexml(String(s)));
case 'boolean': return writextag('vt:bool',s?'true':'false');
}
if(s instanceof Date) return writextag('vt:filetime', write_w3cdtf(s));
@ -13875,7 +13875,7 @@ function parse_core_props(data) {
for(var i = 0; i < CORE_PROPS.length; ++i) {
var f = CORE_PROPS[i], cur = data.match(CORE_PROPS_REGEX[i]);
if(cur != null && cur.length > 0) p[f[1]] = cur[1];
if(cur != null && cur.length > 0) p[f[1]] = unescapexml(cur[1]);
if(f[2] === 'date' && p[f[1]]) p[f[1]] = parseDate(p[f[1]]);
}
@ -13894,6 +13894,7 @@ var CORE_PROPS_XML_ROOT = writextag('cp:coreProperties', null, {
function cp_doit(f, g, h, o, p) {
if(p[f] != null || g == null || g === "") return;
p[f] = g;
g = escapexml(g);
o[o.length] = (h ? writextag(f,g,h) : writetag(f,g));
}
@ -13994,9 +13995,10 @@ function parse_ext_props(data, p, opts) {
data = utf8read(data);
EXT_PROPS.forEach(function(f) {
var xml = (data.match(matchtag(f[0]))||[])[1];
switch(f[2]) {
case "string": p[f[1]] = (data.match(matchtag(f[0]))||[])[1]; break;
case "bool": p[f[1]] = (data.match(matchtag(f[0]))||[])[1] === "true"; break;
case "string": p[f[1]] = unescapexml(xml||""); break;
case "bool": p[f[1]] = xml === "true"; break;
case "raw":
var cur = data.match(new RegExp("<" + f[0] + "[^>]*>([\\s\\S]*?)<\/" + f[0] + ">"));
if(cur && cur.length > 0) q[f[1]] = cur[1];
@ -14025,7 +14027,7 @@ function write_ext_props(cp) {
if(cp[f[1]] === undefined) return;
var v;
switch(f[2]) {
case 'string': v = String(cp[f[1]]); break;
case 'string': v = escapexml(String(cp[f[1]])); break;
case 'bool': v = cp[f[1]] ? 'true' : 'false'; break;
}
if(v !== undefined) o[o.length] = (W(f[0], v));
@ -14050,7 +14052,7 @@ function parse_cust_props(data, opts) {
switch(y[0]) {
case '<?xml': break;
case '<Properties': break;
case '<property': name = y.name; break;
case '<property': name = unescapexml(y.name); break;
case '</property>': name = null; break;
default: if (x.indexOf('<vt:') === 0) {
var toks = x.split('>');
@ -14099,7 +14101,7 @@ function write_cust_props(cp) {
o[o.length] = (writextag('property', write_vt(cp[k]), {
'fmtid': '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}',
'pid': pid,
'name': k
'name': escapexml(k)
}));
});
if(o.length>2){ o[o.length] = '</Properties>'; o[1]=o[1].replace("/>",">"); }

16
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

File diff suppressed because one or more lines are too long

20
dist/xlsx.js generated vendored
View File

@ -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.15.2';
XLSX.version = '0.15.3';
var current_codepage = 1200, current_ansi = 1252;
/*global cptable:true, window */
if(typeof module !== "undefined" && typeof require !== 'undefined') {
@ -3114,8 +3114,8 @@ function write_w3cdtf(d, t) { try { return d.toISOString().replace(/\.\d*/,"");
function write_vt(s) {
switch(typeof s) {
case 'string': return writextag('vt:lpwstr', s);
case 'number': return writextag((s|0)==s?'vt:i4':'vt:r8', String(s));
case 'string': return writextag('vt:lpwstr', escapexml(s));
case 'number': return writextag((s|0)==s?'vt:i4':'vt:r8', escapexml(String(s)));
case 'boolean': return writextag('vt:bool',s?'true':'false');
}
if(s instanceof Date) return writextag('vt:filetime', write_w3cdtf(s));
@ -4719,7 +4719,7 @@ function parse_core_props(data) {
for(var i = 0; i < CORE_PROPS.length; ++i) {
var f = CORE_PROPS[i], cur = data.match(CORE_PROPS_REGEX[i]);
if(cur != null && cur.length > 0) p[f[1]] = cur[1];
if(cur != null && cur.length > 0) p[f[1]] = unescapexml(cur[1]);
if(f[2] === 'date' && p[f[1]]) p[f[1]] = parseDate(p[f[1]]);
}
@ -4738,6 +4738,7 @@ var CORE_PROPS_XML_ROOT = writextag('cp:coreProperties', null, {
function cp_doit(f, g, h, o, p) {
if(p[f] != null || g == null || g === "") return;
p[f] = g;
g = escapexml(g);
o[o.length] = (h ? writextag(f,g,h) : writetag(f,g));
}
@ -4838,9 +4839,10 @@ function parse_ext_props(data, p, opts) {
data = utf8read(data);
EXT_PROPS.forEach(function(f) {
var xml = (data.match(matchtag(f[0]))||[])[1];
switch(f[2]) {
case "string": p[f[1]] = (data.match(matchtag(f[0]))||[])[1]; break;
case "bool": p[f[1]] = (data.match(matchtag(f[0]))||[])[1] === "true"; break;
case "string": p[f[1]] = unescapexml(xml||""); break;
case "bool": p[f[1]] = xml === "true"; break;
case "raw":
var cur = data.match(new RegExp("<" + f[0] + "[^>]*>([\\s\\S]*?)<\/" + f[0] + ">"));
if(cur && cur.length > 0) q[f[1]] = cur[1];
@ -4869,7 +4871,7 @@ function write_ext_props(cp) {
if(cp[f[1]] === undefined) return;
var v;
switch(f[2]) {
case 'string': v = String(cp[f[1]]); break;
case 'string': v = escapexml(String(cp[f[1]])); break;
case 'bool': v = cp[f[1]] ? 'true' : 'false'; break;
}
if(v !== undefined) o[o.length] = (W(f[0], v));
@ -4894,7 +4896,7 @@ function parse_cust_props(data, opts) {
switch(y[0]) {
case '<?xml': break;
case '<Properties': break;
case '<property': name = y.name; break;
case '<property': name = unescapexml(y.name); break;
case '</property>': name = null; break;
default: if (x.indexOf('<vt:') === 0) {
var toks = x.split('>');
@ -4943,7 +4945,7 @@ function write_cust_props(cp) {
o[o.length] = (writextag('property', write_vt(cp[k]), {
'fmtid': '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}',
'pid': pid,
'name': k
'name': escapexml(k)
}));
});
if(o.length>2){ o[o.length] = '</Properties>'; o[1]=o[1].replace("/>",">"); }

8
dist/xlsx.min.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/xlsx.min.map generated vendored

File diff suppressed because one or more lines are too long

10
dist/xlsx.mini.min.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/xlsx.mini.min.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "xlsx",
"version": "0.15.2",
"version": "0.15.3",
"author": "sheetjs",
"description": "SheetJS Spreadsheet data parser and writer",
"keywords": [

View File

@ -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.15.2';
XLSX.version = '0.15.3';
var current_codepage = 1200, current_ansi = 1252;
/*:: declare var cptable:any; */
/*global cptable:true, window */
@ -3195,8 +3195,8 @@ function write_w3cdtf(d/*:Date*/, t/*:?boolean*/)/*:string*/ { try { return d.to
function write_vt(s)/*:string*/ {
switch(typeof s) {
case 'string': return writextag('vt:lpwstr', s);
case 'number': return writextag((s|0)==s?'vt:i4':'vt:r8', String(s));
case 'string': return writextag('vt:lpwstr', escapexml(s));
case 'number': return writextag((s|0)==s?'vt:i4':'vt:r8', escapexml(String(s)));
case 'boolean': return writextag('vt:bool',s?'true':'false');
}
if(s instanceof Date) return writextag('vt:filetime', write_w3cdtf(s));
@ -4812,7 +4812,7 @@ function parse_core_props(data) {
for(var i = 0; i < CORE_PROPS.length; ++i) {
var f = CORE_PROPS[i], cur = data.match(CORE_PROPS_REGEX[i]);
if(cur != null && cur.length > 0) p[f[1]] = cur[1];
if(cur != null && cur.length > 0) p[f[1]] = unescapexml(cur[1]);
if(f[2] === 'date' && p[f[1]]) p[f[1]] = parseDate(p[f[1]]);
}
@ -4831,6 +4831,7 @@ var CORE_PROPS_XML_ROOT = writextag('cp:coreProperties', null, {
function cp_doit(f, g, h, o, p) {
if(p[f] != null || g == null || g === "") return;
p[f] = g;
g = escapexml(g);
o[o.length] = (h ? writextag(f,g,h) : writetag(f,g));
}
@ -4931,9 +4932,10 @@ function parse_ext_props(data, p, opts) {
data = utf8read(data);
EXT_PROPS.forEach(function(f) {
var xml = (data.match(matchtag(f[0]))||[])[1];
switch(f[2]) {
case "string": p[f[1]] = (data.match(matchtag(f[0]))||[])[1]; break;
case "bool": p[f[1]] = (data.match(matchtag(f[0]))||[])[1] === "true"; break;
case "string": p[f[1]] = unescapexml(xml||""); break;
case "bool": p[f[1]] = xml === "true"; break;
case "raw":
var cur = data.match(new RegExp("<" + f[0] + "[^>]*>([\\s\\S]*?)<\/" + f[0] + ">"));
if(cur && cur.length > 0) q[f[1]] = cur[1];
@ -4962,7 +4964,7 @@ function write_ext_props(cp/*::, opts*/)/*:string*/ {
if(cp[f[1]] === undefined) return;
var v;
switch(f[2]) {
case 'string': v = String(cp[f[1]]); break;
case 'string': v = escapexml(String(cp[f[1]])); break;
case 'bool': v = cp[f[1]] ? 'true' : 'false'; break;
}
if(v !== undefined) o[o.length] = (W(f[0], v));
@ -4987,7 +4989,7 @@ function parse_cust_props(data/*:string*/, opts) {
switch(y[0]) {
case '<?xml': break;
case '<Properties': break;
case '<property': name = y.name; break;
case '<property': name = unescapexml(y.name); break;
case '</property>': name = null; break;
default: if (x.indexOf('<vt:') === 0) {
var toks = x.split('>');
@ -5036,7 +5038,7 @@ function write_cust_props(cp/*::, opts*/)/*:string*/ {
o[o.length] = (writextag('property', write_vt(cp[k]), {
'fmtid': '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}',
'pid': pid,
'name': k
'name': escapexml(k)
}));
});
if(o.length>2){ o[o.length] = '</Properties>'; o[1]=o[1].replace("/>",">"); }

20
xlsx.js generated
View File

@ -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.15.2';
XLSX.version = '0.15.3';
var current_codepage = 1200, current_ansi = 1252;
/*global cptable:true, window */
if(typeof module !== "undefined" && typeof require !== 'undefined') {
@ -3114,8 +3114,8 @@ function write_w3cdtf(d, t) { try { return d.toISOString().replace(/\.\d*/,"");
function write_vt(s) {
switch(typeof s) {
case 'string': return writextag('vt:lpwstr', s);
case 'number': return writextag((s|0)==s?'vt:i4':'vt:r8', String(s));
case 'string': return writextag('vt:lpwstr', escapexml(s));
case 'number': return writextag((s|0)==s?'vt:i4':'vt:r8', escapexml(String(s)));
case 'boolean': return writextag('vt:bool',s?'true':'false');
}
if(s instanceof Date) return writextag('vt:filetime', write_w3cdtf(s));
@ -4719,7 +4719,7 @@ function parse_core_props(data) {
for(var i = 0; i < CORE_PROPS.length; ++i) {
var f = CORE_PROPS[i], cur = data.match(CORE_PROPS_REGEX[i]);
if(cur != null && cur.length > 0) p[f[1]] = cur[1];
if(cur != null && cur.length > 0) p[f[1]] = unescapexml(cur[1]);
if(f[2] === 'date' && p[f[1]]) p[f[1]] = parseDate(p[f[1]]);
}
@ -4738,6 +4738,7 @@ var CORE_PROPS_XML_ROOT = writextag('cp:coreProperties', null, {
function cp_doit(f, g, h, o, p) {
if(p[f] != null || g == null || g === "") return;
p[f] = g;
g = escapexml(g);
o[o.length] = (h ? writextag(f,g,h) : writetag(f,g));
}
@ -4838,9 +4839,10 @@ function parse_ext_props(data, p, opts) {
data = utf8read(data);
EXT_PROPS.forEach(function(f) {
var xml = (data.match(matchtag(f[0]))||[])[1];
switch(f[2]) {
case "string": p[f[1]] = (data.match(matchtag(f[0]))||[])[1]; break;
case "bool": p[f[1]] = (data.match(matchtag(f[0]))||[])[1] === "true"; break;
case "string": p[f[1]] = unescapexml(xml||""); break;
case "bool": p[f[1]] = xml === "true"; break;
case "raw":
var cur = data.match(new RegExp("<" + f[0] + "[^>]*>([\\s\\S]*?)<\/" + f[0] + ">"));
if(cur && cur.length > 0) q[f[1]] = cur[1];
@ -4869,7 +4871,7 @@ function write_ext_props(cp) {
if(cp[f[1]] === undefined) return;
var v;
switch(f[2]) {
case 'string': v = String(cp[f[1]]); break;
case 'string': v = escapexml(String(cp[f[1]])); break;
case 'bool': v = cp[f[1]] ? 'true' : 'false'; break;
}
if(v !== undefined) o[o.length] = (W(f[0], v));
@ -4894,7 +4896,7 @@ function parse_cust_props(data, opts) {
switch(y[0]) {
case '<?xml': break;
case '<Properties': break;
case '<property': name = y.name; break;
case '<property': name = unescapexml(y.name); break;
case '</property>': name = null; break;
default: if (x.indexOf('<vt:') === 0) {
var toks = x.split('>');
@ -4943,7 +4945,7 @@ function write_cust_props(cp) {
o[o.length] = (writextag('property', write_vt(cp[k]), {
'fmtid': '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}',
'pid': pid,
'name': k
'name': escapexml(k)
}));
});
if(o.length>2){ o[o.length] = '</Properties>'; o[1]=o[1].replace("/>",">"); }

View File

@ -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.15.2';
XLSX.version = '0.15.3';
var current_codepage = 1200, current_ansi = 1252;
var VALID_ANSI = [ 874, 932, 936, 949, 950 ];
@ -3157,8 +3157,8 @@ function write_w3cdtf(d/*:Date*/, t/*:?boolean*/)/*:string*/ { try { return d.to
function write_vt(s)/*:string*/ {
switch(typeof s) {
case 'string': return writextag('vt:lpwstr', s);
case 'number': return writextag((s|0)==s?'vt:i4':'vt:r8', String(s));
case 'string': return writextag('vt:lpwstr', escapexml(s));
case 'number': return writextag((s|0)==s?'vt:i4':'vt:r8', escapexml(String(s)));
case 'boolean': return writextag('vt:bool',s?'true':'false');
}
if(s instanceof Date) return writextag('vt:filetime', write_w3cdtf(s));
@ -4389,7 +4389,7 @@ function parse_core_props(data) {
for(var i = 0; i < CORE_PROPS.length; ++i) {
var f = CORE_PROPS[i], cur = data.match(CORE_PROPS_REGEX[i]);
if(cur != null && cur.length > 0) p[f[1]] = cur[1];
if(cur != null && cur.length > 0) p[f[1]] = unescapexml(cur[1]);
if(f[2] === 'date' && p[f[1]]) p[f[1]] = parseDate(p[f[1]]);
}
@ -4408,6 +4408,7 @@ var CORE_PROPS_XML_ROOT = writextag('cp:coreProperties', null, {
function cp_doit(f, g, h, o, p) {
if(p[f] != null || g == null || g === "") return;
p[f] = g;
g = escapexml(g);
o[o.length] = (h ? writextag(f,g,h) : writetag(f,g));
}
@ -4508,9 +4509,10 @@ function parse_ext_props(data, p, opts) {
data = utf8read(data);
EXT_PROPS.forEach(function(f) {
var xml = (data.match(matchtag(f[0]))||[])[1];
switch(f[2]) {
case "string": p[f[1]] = (data.match(matchtag(f[0]))||[])[1]; break;
case "bool": p[f[1]] = (data.match(matchtag(f[0]))||[])[1] === "true"; break;
case "string": p[f[1]] = unescapexml(xml||""); break;
case "bool": p[f[1]] = xml === "true"; break;
case "raw":
var cur = data.match(new RegExp("<" + f[0] + "[^>]*>([\\s\\S]*?)<\/" + f[0] + ">"));
if(cur && cur.length > 0) q[f[1]] = cur[1];
@ -4539,7 +4541,7 @@ function write_ext_props(cp/*::, opts*/)/*:string*/ {
if(cp[f[1]] === undefined) return;
var v;
switch(f[2]) {
case 'string': v = String(cp[f[1]]); break;
case 'string': v = escapexml(String(cp[f[1]])); break;
case 'bool': v = cp[f[1]] ? 'true' : 'false'; break;
}
if(v !== undefined) o[o.length] = (W(f[0], v));
@ -4564,7 +4566,7 @@ function parse_cust_props(data/*:string*/, opts) {
switch(y[0]) {
case '<?xml': break;
case '<Properties': break;
case '<property': name = y.name; break;
case '<property': name = unescapexml(y.name); break;
case '</property>': name = null; break;
default: if (x.indexOf('<vt:') === 0) {
var toks = x.split('>');
@ -4613,7 +4615,7 @@ function write_cust_props(cp/*::, opts*/)/*:string*/ {
o[o.length] = (writextag('property', write_vt(cp[k]), {
'fmtid': '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}',
'pid': pid,
'name': k
'name': escapexml(k)
}));
});
if(o.length>2){ o[o.length] = '</Properties>'; o[1]=o[1].replace("/>",">"); }

View File

@ -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.15.2';
XLSX.version = '0.15.3';
var current_codepage = 1200, current_ansi = 1252;
var VALID_ANSI = [ 874, 932, 936, 949, 950 ];
@ -3078,8 +3078,8 @@ function write_w3cdtf(d, t) { try { return d.toISOString().replace(/\.\d*/,"");
function write_vt(s) {
switch(typeof s) {
case 'string': return writextag('vt:lpwstr', s);
case 'number': return writextag((s|0)==s?'vt:i4':'vt:r8', String(s));
case 'string': return writextag('vt:lpwstr', escapexml(s));
case 'number': return writextag((s|0)==s?'vt:i4':'vt:r8', escapexml(String(s)));
case 'boolean': return writextag('vt:bool',s?'true':'false');
}
if(s instanceof Date) return writextag('vt:filetime', write_w3cdtf(s));
@ -4299,7 +4299,7 @@ function parse_core_props(data) {
for(var i = 0; i < CORE_PROPS.length; ++i) {
var f = CORE_PROPS[i], cur = data.match(CORE_PROPS_REGEX[i]);
if(cur != null && cur.length > 0) p[f[1]] = cur[1];
if(cur != null && cur.length > 0) p[f[1]] = unescapexml(cur[1]);
if(f[2] === 'date' && p[f[1]]) p[f[1]] = parseDate(p[f[1]]);
}
@ -4318,6 +4318,7 @@ var CORE_PROPS_XML_ROOT = writextag('cp:coreProperties', null, {
function cp_doit(f, g, h, o, p) {
if(p[f] != null || g == null || g === "") return;
p[f] = g;
g = escapexml(g);
o[o.length] = (h ? writextag(f,g,h) : writetag(f,g));
}
@ -4418,9 +4419,10 @@ function parse_ext_props(data, p, opts) {
data = utf8read(data);
EXT_PROPS.forEach(function(f) {
var xml = (data.match(matchtag(f[0]))||[])[1];
switch(f[2]) {
case "string": p[f[1]] = (data.match(matchtag(f[0]))||[])[1]; break;
case "bool": p[f[1]] = (data.match(matchtag(f[0]))||[])[1] === "true"; break;
case "string": p[f[1]] = unescapexml(xml||""); break;
case "bool": p[f[1]] = xml === "true"; break;
case "raw":
var cur = data.match(new RegExp("<" + f[0] + "[^>]*>([\\s\\S]*?)<\/" + f[0] + ">"));
if(cur && cur.length > 0) q[f[1]] = cur[1];
@ -4449,7 +4451,7 @@ function write_ext_props(cp) {
if(cp[f[1]] === undefined) return;
var v;
switch(f[2]) {
case 'string': v = String(cp[f[1]]); break;
case 'string': v = escapexml(String(cp[f[1]])); break;
case 'bool': v = cp[f[1]] ? 'true' : 'false'; break;
}
if(v !== undefined) o[o.length] = (W(f[0], v));
@ -4474,7 +4476,7 @@ function parse_cust_props(data, opts) {
switch(y[0]) {
case '<?xml': break;
case '<Properties': break;
case '<property': name = y.name; break;
case '<property': name = unescapexml(y.name); break;
case '</property>': name = null; break;
default: if (x.indexOf('<vt:') === 0) {
var toks = x.split('>');
@ -4523,7 +4525,7 @@ function write_cust_props(cp) {
o[o.length] = (writextag('property', write_vt(cp[k]), {
'fmtid': '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}',
'pid': pid,
'name': k
'name': escapexml(k)
}));
});
if(o.length>2){ o[o.length] = '</Properties>'; o[1]=o[1].replace("/>",">"); }