Skip to content

Commit 0cc6cc9

Browse files
赵风昭SheetJSDev
andcommitted
XLSX verify formula is string (fixes #1703)
Co-authored-by: SheetJS <[email protected]>
1 parent 2c5a863 commit 0cc6cc9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bits/67_wsxml.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ function write_ws_xml_sheetviews(ws, opts, idx, wb)/*:string*/ {
242242
}
243243

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

0 commit comments

Comments
 (0)