diff --git a/bits/22_xmlutils.js b/bits/22_xmlutils.js index 82e48f6..ebbc418 100644 --- a/bits/22_xmlutils.js +++ b/bits/22_xmlutils.js @@ -138,12 +138,15 @@ var vtregex = (function(){ var vt_cache = {}; return (vt_cache[bt] = new RegExp("<(?:vt:)?" + bt + ">([\\s\\S]*?)", 'g') ); };})(); var vtvregex = /<\/?(?:vt:)?variant>/g, vtmregex = /<(?:vt:)([^>]*)>([\s\S]*) >*/ = [ XMLNS.EXT_PROPS = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"; RELS.EXT_PROPS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties'; -function parse_ext_props(data, p) { +function parse_ext_props(data, p, opts) { var q = {}; if(!p) p = {}; EXT_PROPS.forEach(function(f) { @@ -32,10 +32,10 @@ function parse_ext_props(data, p) { }); if(q.HeadingPairs && q.TitlesOfParts) { - var v = parseVector(q.HeadingPairs); - var parts = parseVector(q.TitlesOfParts).map(function(x) { return x.v; }); + var v = parseVector(q.HeadingPairs, opts); + var parts = parseVector(q.TitlesOfParts, opts).map(function (x) { return x.v; }); var idx = 0, len = 0; - for(var i = 0; i !== v.length; i+=2) { + if(parts.length > 0) for(var i = 0; i !== v.length; i += 2) { len = +(v[i+1].v); switch(v[i].v) { case "Worksheets": diff --git a/bits/85_parsezip.js b/bits/85_parsezip.js index d8158c7..935d1d0 100644 --- a/bits/85_parsezip.js +++ b/bits/85_parsezip.js @@ -86,7 +86,7 @@ function parse_zip(zip/*:ZIP*/, opts/*:?ParseOpts*/)/*:Workbook*/ { if(propdata) props = parse_core_props(propdata); if(dir.extprops.length !== 0) { propdata = getzipstr(zip, dir.extprops[0].replace(/^\//,''), true); - if(propdata) parse_ext_props(propdata, props); + if(propdata) parse_ext_props(propdata, props, opts); } } diff --git a/xlsx.flow.js b/xlsx.flow.js index ac5032c..95f1b09 100644 --- a/xlsx.flow.js +++ b/xlsx.flow.js @@ -1803,12 +1803,15 @@ var vtregex = (function(){ var vt_cache = {}; return (vt_cache[bt] = new RegExp("<(?:vt:)?" + bt + ">([\\s\\S]*?)", 'g') ); };})(); var vtvregex = /<\/?(?:vt:)?variant>/g, vtmregex = /<(?:vt:)([^>]*)>([\s\S]*) >*/ = [ XMLNS.EXT_PROPS = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"; RELS.EXT_PROPS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties'; -function parse_ext_props(data, p) { +function parse_ext_props(data, p, opts) { var q = {}; if(!p) p = {}; EXT_PROPS.forEach(function(f) { @@ -3423,10 +3426,10 @@ function parse_ext_props(data, p) { }); if(q.HeadingPairs && q.TitlesOfParts) { - var v = parseVector(q.HeadingPairs); - var parts = parseVector(q.TitlesOfParts).map(function(x) { return x.v; }); + var v = parseVector(q.HeadingPairs, opts); + var parts = parseVector(q.TitlesOfParts, opts).map(function (x) { return x.v; }); var idx = 0, len = 0; - for(var i = 0; i !== v.length; i+=2) { + if(parts.length > 0) for(var i = 0; i !== v.length; i += 2) { len = +(v[i+1].v); switch(v[i].v) { case "Worksheets": @@ -17279,7 +17282,7 @@ function parse_zip(zip/*:ZIP*/, opts/*:?ParseOpts*/)/*:Workbook*/ { if(propdata) props = parse_core_props(propdata); if(dir.extprops.length !== 0) { propdata = getzipstr(zip, dir.extprops[0].replace(/^\//,''), true); - if(propdata) parse_ext_props(propdata, props); + if(propdata) parse_ext_props(propdata, props, opts); } } diff --git a/xlsx.js b/xlsx.js index a0f075b..a73eb78 100644 --- a/xlsx.js +++ b/xlsx.js @@ -1739,12 +1739,15 @@ var vtregex = (function(){ var vt_cache = {}; return (vt_cache[bt] = new RegExp("<(?:vt:)?" + bt + ">([\\s\\S]*?)", 'g') ); };})(); var vtvregex = /<\/?(?:vt:)?variant>/g, vtmregex = /<(?:vt:)([^>]*)>([\s\S]*) 0) for(var i = 0; i !== v.length; i += 2) { len = +(v[i+1].v); switch(v[i].v) { case "Worksheets": @@ -17192,7 +17195,7 @@ function parse_zip(zip, opts) { if(propdata) props = parse_core_props(propdata); if(dir.extprops.length !== 0) { propdata = getzipstr(zip, dir.extprops[0].replace(/^\//,''), true); - if(propdata) parse_ext_props(propdata, props); + if(propdata) parse_ext_props(propdata, props, opts); } }