From 2f329b64e228db60227e9d8a7e28dad02bd4fb5e Mon Sep 17 00:00:00 2001 From: SheetJS Date: Tue, 4 Oct 2022 20:09:43 -0400 Subject: [PATCH] DBF truncate numeric fields --- bits/40_harb.js | 1 + 1 file changed, 1 insertion(+) diff --git a/bits/40_harb.js b/bits/40_harb.js index 7e71b49..9f6f61f 100644 --- a/bits/40_harb.js +++ b/bits/40_harb.js @@ -347,6 +347,7 @@ function sheet_to_dbf(ws/*:Worksheet*/, opts/*:WriteOpts*/) { case 'N': var _n = "0"; if(typeof data[i][j] == "number") _n = data[i][j].toFixed(coldecimals[j]||0); + if(_n.length > colwidths[j]) _n = _n.slice(0, colwidths[j]); // addresses decimal > width for(hcnt=0; hcnt < colwidths[j]-_n.length; ++hcnt) rout.write_shift(1, 0x20); rout.write_shift(1, _n, "sbcs"); break;