From 576b59f96a54b010a738061a1bfe69410d303f31 Mon Sep 17 00:00:00 2001 From: Pieter Sheth-Voss Date: Mon, 2 Mar 2015 00:28:11 -0500 Subject: [PATCH] Fix issue with custom formats --- bits/66_wscommon.js | 2 +- bits/92_stylebuilder.js | 5 +++-- xlsx.js | 7 ++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/bits/66_wscommon.js b/bits/66_wscommon.js index 4ccb178..5030781 100644 --- a/bits/66_wscommon.js +++ b/bits/66_wscommon.js @@ -13,7 +13,7 @@ function get_cell_style(styles, cell, opts) { if (cell.s && (cell.s == +cell.s)) { return cell.s} // if its already an integer index, let it be if (!cell.s) cell.s = {} - if (cell.z) cell.s.numFmtId = cell.z; + if (cell.z) cell.s.numFmt = cell.z; cell.s = style_builder.addStyle(cell.s); return cell.s; diff --git a/bits/92_stylebuilder.js b/bits/92_stylebuilder.js index 43a0906..ef1c75b 100644 --- a/bits/92_stylebuilder.js +++ b/bits/92_stylebuilder.js @@ -252,7 +252,8 @@ if ((typeof 'module' != 'undefined' && typeof require != 'undefined') || (typeo return numFmt; // we're matching an integer against some known code } - var $numFmt = XmlNode(numFmt) + + var $numFmt = XmlNode('numFmt') .attr('numFmtId', (++customNumFmtId)) .attr('formatCode', numFmt); @@ -261,7 +262,7 @@ if ((typeof 'module' != 'undefined' && typeof require != 'undefined') || (typeo var count = this.$numFmts.children().length; this.$numFmts.attr('count', count); - return customNumFmtId; + return customNumFmtId ; }, _addFill: function (attributes) { diff --git a/xlsx.js b/xlsx.js index 8680725..5e60172 100644 --- a/xlsx.js +++ b/xlsx.js @@ -2795,7 +2795,7 @@ function get_cell_style(styles, cell, opts) { if (cell.s && (cell.s == +cell.s)) { return cell.s} // if its already an integer index, let it be if (!cell.s) cell.s = {} - if (cell.z) cell.s.numFmtId = cell.z; + if (cell.z) cell.s.numFmt = cell.z; cell.s = style_builder.addStyle(cell.s); return cell.s; @@ -5743,7 +5743,8 @@ if ((typeof 'module' != 'undefined' && typeof require != 'undefined') || (typeo return numFmt; // we're matching an integer against some known code } - var $numFmt = XmlNode(numFmt) + + var $numFmt = XmlNode('numFmt') .attr('numFmtId', (++customNumFmtId)) .attr('formatCode', numFmt); @@ -5752,7 +5753,7 @@ if ((typeof 'module' != 'undefined' && typeof require != 'undefined') || (typeo var count = this.$numFmts.children().length; this.$numFmts.attr('count', count); - return customNumFmtId; + return customNumFmtId ; }, _addFill: function (attributes) {