Skip to content

Commit 0ad3afc

Browse files
committed
ACI0105499 When exporting add a default format for number with floating point errors
1 parent 3b43c34 commit 0ad3afc

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

Resources/scripts/commands/file.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,14 +1202,20 @@ Utils.addFormatedText = function (json) {
12021202
}
12031203

12041204
// apply default date formatting
1205-
if (_noFormatInfo()
1206-
&& ((typeof (cell.value) === 'string')
1207-
&& (cell.value.startsWith("/OADate("))
1208-
&& (cell.value.endsWith(")/")))) {
1209-
if (cell.value.indexOf(".") > -1) {
1210-
_createFormatInfo(longDatePattern);
1211-
} else {
1212-
_createFormatInfo(shortDatePattern);
1205+
if (_noFormatInfo()) {
1206+
if ((typeof (cell.value) === 'string')) {
1207+
if ((cell.value.startsWith("/OADate(")) && (cell.value.endsWith(")/"))) {
1208+
_createFormatInfo((cell.value.indexOf(".") > -1)? longDatePattern: shortDatePattern);
1209+
}
1210+
}
1211+
else if (((typeof (cell.value) === 'number'))) {
1212+
let fixed = Number(cell.value.toFixed(13)).toString();
1213+
if (fixed != cell.value.toString()) {
1214+
if (!('style' in cell)) {
1215+
cell.style = {};
1216+
}
1217+
cell.style.formatInfo = { text: Number(cell.value.toFixed(13)).toString() };
1218+
}
12131219
}
12141220
}
12151221

0 commit comments

Comments
 (0)