Commit 1b8f91b9 authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

Bug 24530 - Выставленный пользователем формат ячейки меняется после повторного ввода данных.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56447 954022d7-b5bf-4e40-9824-e11837661b57
parent e0720282
...@@ -2784,6 +2784,7 @@ FormatParser.prototype = ...@@ -2784,6 +2784,7 @@ FormatParser.prototype =
if(!bError){ if(!bError){
var oVal = this._parseThouthand(sVal, cultureInfo); var oVal = this._parseThouthand(sVal, cultureInfo);
if (oVal) { if (oVal) {
res = {format: null, value: null, bDateTime: false, bDate: false, bTime: false, bPercent: false, bCurrency: false};
var dVal = oVal.number; var dVal = oVal.number;
if (bMinus) if (bMinus)
dVal = -dVal; dVal = -dVal;
...@@ -2792,10 +2793,12 @@ FormatParser.prototype = ...@@ -2792,10 +2793,12 @@ FormatParser.prototype =
sFracFormat = gc_sFormatDecimalPoint + "00"; sFracFormat = gc_sFormatDecimalPoint + "00";
var sFormat = null; var sFormat = null;
if (bPercent) { if (bPercent) {
res.bPercent = true;
dVal /= 100; dVal /= 100;
sFormat = "0" + sFracFormat + "%"; sFormat = "0" + sFracFormat + "%";
} }
else if (sCurrency) { else if (sCurrency) {
res.bCurrency = true;
var sNumberFormat = "#" + gc_sFormatThousandSeparator + "##0" + sFracFormat; var sNumberFormat = "#" + gc_sFormatThousandSeparator + "##0" + sFracFormat;
var sCurrencyFormat; var sCurrencyFormat;
if(sCurrency.length > 1) if(sCurrency.length > 1)
...@@ -2877,7 +2880,8 @@ FormatParser.prototype = ...@@ -2877,7 +2880,8 @@ FormatParser.prototype =
} }
else else
sFormat = "General"; sFormat = "General";
res = { format: sFormat, value: dVal }; res.format = sFormat;
res.value = dVal;
} }
} }
} }
...@@ -3442,7 +3446,7 @@ FormatParser.prototype = ...@@ -3442,7 +3446,7 @@ FormatParser.prototype =
else else
sFormat = "h:mm:ss"; sFormat = "h:mm:ss";
} }
res = {format: sFormat, value: dValue, bDateTime: true}; res = {format: sFormat, value: dValue, bDateTime: true, bDate: bDate, bTime: bTime, bPercent: false, bCurrency: false};
} }
} }
} }
......
...@@ -3222,26 +3222,20 @@ CCellValue.prototype = ...@@ -3222,26 +3222,20 @@ CCellValue.prototype =
else else
{ {
//распознаем формат //распознаем формат
var bParsed = false;
var res = g_oFormatParser.parse(val); var res = g_oFormatParser.parse(val);
if(null != res) if(null != res)
{ {
//Сравниваем с текущим форматом, если типы совпадают - меняем только значение ячейки //Сравниваем с текущим форматом, если типы совпадают - меняем только значение ячейки
var oTargetFormat = null; var nFormatType = oNumFormat.getType();
if(null != oNumFormat) if(!((c_oAscNumFormatType.Percent == nFormatType && res.bPercent) ||
oTargetFormat = oNumFormat.getFormatByValue(res.value); (c_oAscNumFormatType.Currency == nFormatType && res.bCurrency) ||
if(res.bDateTime) (c_oAscNumFormatType.Date == nFormatType && res.bDate) ||
{ (c_oAscNumFormatType.Time == nFormatType && res.bTime)) && res.format != oNumFormat.sFormat)
if(null == oTargetFormat || res.bDateTime != oTargetFormat.bDateTime)
this.cell.setNumFormat(res.format);
}
else if(res.format != oNumFormat.sFormat)
this.cell.setNumFormat(res.format); this.cell.setNumFormat(res.format);
this.number = res.value; this.number = res.value;
this.type = CellValueType.Number; this.type = CellValueType.Number;
bParsed = true;
} }
if(false == bParsed) else
{ {
this.type = CellValueType.String; this.type = CellValueType.String;
//проверяем QuotePrefix //проверяем QuotePrefix
......
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