HTML preserve cell number format

This commit is contained in:
Michael 2020-04-26 02:02:58 -05:00
parent 0ac53360b2
commit 91f8c46704
2 changed files with 7 additions and 4 deletions

@ -83,6 +83,7 @@ var HTML_ = (function() {
sp.t = cell && cell.t || 'z';
if(o.editable) w = '<span contenteditable="true">' + w + '</span>';
sp.id = (o.id || "sjs") + "-" + coord;
if(sp.t != "z") { sp.v = cell.v; if(cell.z != null) sp.z = cell.z; }
oo.push(writextag('td', w, sp));
}
var preamble = "<tr>";
@ -105,8 +106,8 @@ var HTML_ = (function() {
for(var R = r.s.r; R <= r.e.r; ++R) out.push(make_html_row(ws, r, R, o));
out.push("</table>" + footer);
return out.join("");
}
}
return {
to_workbook: html_to_book,
to_sheet: html_to_sheet,
@ -138,7 +139,8 @@ function parse_dom_table(table/*:HTMLElement*/, _opts/*:?any*/)/*:Worksheet*/ {
for(_C = C = 0; _C < elts.length; ++_C) {
var elt/*:HTMLTableCellElement*/ = elts[_C];
if (opts.display && is_dom_element_hidden(elt)) continue;
var v/*:string*/ = htmldecode(elt.innerHTML);
var v/*:string*/ = elt.hasAttribute('v') ? elt.getAttribute('v') : htmldecode(elt.innerHTML);
var z/*:string*/ = elt.getAttribute('z');
for(midx = 0; midx < merges.length; ++midx) {
var m/*:Range*/ = merges[midx];
if(m.s.c == C && m.s.r <= R && R <= m.e.r) { C = m.e.c+1; midx = -1; }
@ -160,7 +162,8 @@ function parse_dom_table(table/*:HTMLElement*/, _opts/*:?any*/)/*:Worksheet*/ {
o.z = opts.dateNF || SSF._table[14];
}
}
if(opts.dense) { if(!ws[R]) ws[R] = []; ws[R][C] = o; }
if(o.z === undefined && z != null) o.z = z;
if(opts.dense) { if(!ws[R]) ws[R] = []; ws[R][C] = o;}
else ws[encode_cell({c:C, r:R})] = o;
if(range.e.c < C) range.e.c = C;
C += CS;

@ -1 +1 @@
Subproject commit a4155e4c17fbe2aba8a79ebe6c17d76f4277901e
Subproject commit f1780af21ee98d62278283b4a455a2a4a21b2889