From 88e662af99d5f9e3d5c09f98c3627383ffcafa2c Mon Sep 17 00:00:00 2001 From: reviewher Date: Thu, 23 Sep 2021 00:19:42 -0700 Subject: [PATCH] empty row parsing (fixes #1413) [ci skip] --- bits/67_wsxml.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/bits/67_wsxml.js b/bits/67_wsxml.js index 1ff5ded..beed368 100644 --- a/bits/67_wsxml.js +++ b/bits/67_wsxml.js @@ -326,8 +326,26 @@ return function parse_ws_xml_data(sdata/*:string*/, s, opts, guess/*:Range*/, th if(xlen === 0) continue; /* 18.3.1.73 row CT_Row */ - for(ri = 0; ri < xlen; ++ri) if(x.charCodeAt(ri) === 62) break; ++ri; - tag = parsexmltag(x.slice(0,ri), true); + var rstarti = 0; + outa: for(ri = 0; ri < xlen; ++ri) switch(/*x.charCodeAt(ri)*/x[ri]) { + case ">" /*62*/: + if(/*x.charCodeAt(ri-1) != 47*/x[ri-1] != "/") { ++ri; break outa; } + if(opts && opts.cellStyles) { + // TODO: avoid duplication + tag = parsexmltag(x.slice(rstarti,ri), true); + tagr = tag.r != null ? parseInt(tag.r, 10) : tagr+1; tagc = -1; + if(opts.sheetRows && opts.sheetRows < tagr) continue; + rowobj = {}; rowrite = false; + if(tag.ht) { rowrite = true; rowobj.hpt = parseFloat(tag.ht); rowobj.hpx = pt2px(rowobj.hpt); } + if(tag.hidden == "1") { rowrite = true; rowobj.hidden = true; } + if(tag.outlineLevel != null) { rowrite = true; rowobj.level = +tag.outlineLevel; } + if(rowrite) rows[tagr-1] = rowobj; + } + break; + case "<" /*60*/: rstarti = ri; break; + } + if(rstarti >= ri) break; + tag = parsexmltag(x.slice(rstarti,ri), true); tagr = tag.r != null ? parseInt(tag.r, 10) : tagr+1; tagc = -1; if(opts.sheetRows && opts.sheetRows < tagr) continue; if(guess.s.r > tagr - 1) guess.s.r = tagr - 1;