Commit 2f749e6a authored by konovalovsergey's avatar konovalovsergey

for bug

fix bug 33092
parent fa76edbc
...@@ -1717,7 +1717,7 @@ cTEXT.prototype.Calculate = function ( arg ) { ...@@ -1717,7 +1717,7 @@ cTEXT.prototype.Calculate = function ( arg ) {
var oFormat = oNumFormatCache.get( arg1.toString() ); var oFormat = oNumFormatCache.get( arg1.toString() );
var a = g_oFormatParser.parse(arg0.getValue()+""), aText; var a = g_oFormatParser.parse(arg0.getValue()+""), aText;
aText = oFormat.format( a ? a.value : arg0.getValue(), (arg0 instanceof cNumber || a) ? CellValueType.Number : CellValueType.String, AscCommon.gc_nMaxDigCountView, null ); aText = oFormat.format( a ? a.value : arg0.getValue(), (arg0 instanceof cNumber || a) ? CellValueType.Number : CellValueType.String, AscCommon.gc_nMaxDigCountView );
var text = ""; var text = "";
for ( var i = 0, length = aText.length; i < length; ++i ) { for ( var i = 0, length = aText.length; i < length; ++i ) {
......
...@@ -5993,35 +5993,25 @@ Cell.prototype.setNumFormat=function(val){ ...@@ -5993,35 +5993,25 @@ Cell.prototype.setNumFormat=function(val){
}; };
Cell.prototype.shiftNumFormat=function(nShift, dDigitsCount){ Cell.prototype.shiftNumFormat=function(nShift, dDigitsCount){
var bRes = false; var bRes = false;
var bGeneral = true;
var sNumFormat; var sNumFormat;
if(null != this.xfs && null != this.xfs.num) if(null != this.xfs && null != this.xfs.num)
sNumFormat = this.xfs.num.getFormat(); sNumFormat = this.xfs.num.getFormat();
else else
sNumFormat = g_oDefaultFormat.Num.getFormat(); sNumFormat = g_oDefaultFormat.Num.getFormat();
if("General" != sNumFormat)
{
var oCurNumFormat = oNumFormatCache.get(sNumFormat); var oCurNumFormat = oNumFormatCache.get(sNumFormat);
if(null != oCurNumFormat && false == oCurNumFormat.isGeneralFormat()) if (null != oCurNumFormat && false == oCurNumFormat.isGeneralFormat()) {
{
bGeneral = false;
var output = {}; var output = {};
bRes = oCurNumFormat.shiftFormat(output, nShift); bRes = oCurNumFormat.shiftFormat(output, nShift);
if(true == bRes) if (true == bRes) {
this.setNumFormat(output.format); this.setNumFormat(output.format);
} }
} } else if (CellValueType.Number == this.oValue.type) {
if(bGeneral)
{
if(CellValueType.Number == this.oValue.type)
{
var sGeneral = AscCommon.DecodeGeneralFormat(this.oValue.number, this.oValue.type, dDigitsCount); var sGeneral = AscCommon.DecodeGeneralFormat(this.oValue.number, this.oValue.type, dDigitsCount);
var oGeneral = oNumFormatCache.get(sGeneral); var oGeneral = oNumFormatCache.get(sGeneral);
if(null != oGeneral && false == oGeneral.isGeneralFormat()) if (null != oGeneral && false == oGeneral.isGeneralFormat()) {
{
var output = {}; var output = {};
bRes = oGeneral.shiftFormat(output, nShift); bRes = oGeneral.shiftFormat(output, nShift);
if(true == bRes) if (true == bRes) {
this.setNumFormat(output.format); this.setNumFormat(output.format);
} }
} }
......
...@@ -3065,10 +3065,9 @@ CCellValue.prototype = ...@@ -3065,10 +3065,9 @@ CCellValue.prototype =
oNumFormat = oNumFormatCache.get(g_oDefaultFormat.Num.getFormat()); oNumFormat = oNumFormatCache.get(g_oDefaultFormat.Num.getFormat());
if(false == oNumFormat.isGeneralFormat()) if(false == oNumFormat.isGeneralFormat())
{ {
var oAdditionalResult = {};
if(null != this.number) if(null != this.number)
{ {
aText = oNumFormat.format(this.number, this.type, dDigitsCount, oAdditionalResult); aText = oNumFormat.format(this.number, this.type, dDigitsCount);
sText = null; sText = null;
} }
else if(CellValueType.String == this.type) else if(CellValueType.String == this.type)
...@@ -3076,12 +3075,12 @@ CCellValue.prototype = ...@@ -3076,12 +3075,12 @@ CCellValue.prototype =
var oTextFormat = oNumFormat.getTextFormat(); var oTextFormat = oNumFormat.getTextFormat();
if (null != oTextFormat && "@" != oTextFormat.formatString) { if (null != oTextFormat && "@" != oTextFormat.formatString) {
if (null != this.text) { if (null != this.text) {
aText = oNumFormat.format(this.text, this.type, dDigitsCount, oAdditionalResult); aText = oNumFormat.format(this.text, this.type, dDigitsCount);
sText = null; sText = null;
} }
else if (null != this.multiText) { else if (null != this.multiText) {
var sSimpleString = this.getStringFromMultiText(); var sSimpleString = this.getStringFromMultiText();
aText = oNumFormat.format(sSimpleString, this.type, dDigitsCount, oAdditionalResult); aText = oNumFormat.format(sSimpleString, this.type, dDigitsCount);
sText = null; sText = null;
} }
} }
......
This diff is collapsed.
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
function(window, undefined) function(window, undefined)
{ {
var g_cCharDelimiter = String.fromCharCode(5); var g_cCharDelimiter = String.fromCharCode(5);
var g_cGeneralFormat = 'General';
var FONT_THUMBNAIL_HEIGHT = (7 * 96.0 / 25.4) >> 0; var FONT_THUMBNAIL_HEIGHT = (7 * 96.0 / 25.4) >> 0;
var c_oAscMaxColumnWidth = 255; var c_oAscMaxColumnWidth = 255;
var c_oAscMaxRowHeight = 409; var c_oAscMaxRowHeight = 409;
...@@ -1418,6 +1419,7 @@ ...@@ -1418,6 +1419,7 @@
window['AscCommon'] = window['AscCommon'] || {}; window['AscCommon'] = window['AscCommon'] || {};
window["AscCommon"].g_cCharDelimiter = g_cCharDelimiter; window["AscCommon"].g_cCharDelimiter = g_cCharDelimiter;
window["AscCommon"].g_cGeneralFormat = g_cGeneralFormat;
window["AscCommon"].bDate1904 = false; window["AscCommon"].bDate1904 = false;
window["AscCommon"].c_oAscAdvancedOptionsAction = c_oAscAdvancedOptionsAction; window["AscCommon"].c_oAscAdvancedOptionsAction = c_oAscAdvancedOptionsAction;
window["AscCommon"].DownloadType = DownloadType; window["AscCommon"].DownloadType = DownloadType;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment