XLSX verify formula is string (fixes #1703)

Co-authored-by: SheetJS <dev@sheetjs.com>
This commit is contained in:
赵风昭 2020-09-08 20:18:48 -04:00 committed by SheetJS
parent 2c5a863420
commit 0cc6cc9627

@ -242,7 +242,7 @@ function write_ws_xml_sheetviews(ws, opts, idx, wb)/*:string*/ {
}
function write_ws_xml_cell(cell/*:Cell*/, ref, ws, opts/*::, idx, wb*/)/*:string*/ {
if(cell.v === undefined && cell.f === undefined || cell.t === 'z') return "";
if(cell.v === undefined && typeof cell.f !== "string" || cell.t === 'z') return "";
var vv = "";
var oldt = cell.t, oldv = cell.v;
if(cell.t !== "z") switch(cell.t) {
@ -278,7 +278,7 @@ function write_ws_xml_cell(cell/*:Cell*/, ref, ws, opts/*::, idx, wb*/)/*:string
o.t = "str"; break;
}
if(cell.t != oldt) { cell.t = oldt; cell.v = oldv; }
if(cell.f) {
if(typeof cell.f == "string" && cell.f) {
var ff = cell.F && cell.F.slice(0, ref.length) == ref ? {t:"array", ref:cell.F} : null;
v = writextag('f', escapexml(cell.f), ff) + (cell.v != null ? v : "");
}