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 =
if(!bError){
var oVal = this._parseThouthand(sVal, cultureInfo);
if (oVal) {
res = {format: null, value: null, bDateTime: false, bDate: false, bTime: false, bPercent: false, bCurrency: false};
var dVal = oVal.number;
if (bMinus)
dVal = -dVal;
......@@ -2792,10 +2793,12 @@ FormatParser.prototype =
sFracFormat = gc_sFormatDecimalPoint + "00";
var sFormat = null;
if (bPercent) {
res.bPercent = true;
dVal /= 100;
sFormat = "0" + sFracFormat + "%";
}
else if (sCurrency) {
res.bCurrency = true;
var sNumberFormat = "#" + gc_sFormatThousandSeparator + "##0" + sFracFormat;
var sCurrencyFormat;
if(sCurrency.length > 1)
......@@ -2877,7 +2880,8 @@ FormatParser.prototype =
}
else
sFormat = "General";
res = { format: sFormat, value: dVal };
res.format = sFormat;
res.value = dVal;
}
}
}
......@@ -3442,7 +3446,7 @@ FormatParser.prototype =
else
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 =
else
{
//распознаем формат
var bParsed = false;
var res = g_oFormatParser.parse(val);
if(null != res)
{
//Сравниваем с текущим форматом, если типы совпадают - меняем только значение ячейки
var oTargetFormat = null;
if(null != oNumFormat)
oTargetFormat = oNumFormat.getFormatByValue(res.value);
if(res.bDateTime)
{
if(null == oTargetFormat || res.bDateTime != oTargetFormat.bDateTime)
this.cell.setNumFormat(res.format);
}
else if(res.format != oNumFormat.sFormat)
var nFormatType = oNumFormat.getType();
if(!((c_oAscNumFormatType.Percent == nFormatType && res.bPercent) ||
(c_oAscNumFormatType.Currency == nFormatType && res.bCurrency) ||
(c_oAscNumFormatType.Date == nFormatType && res.bDate) ||
(c_oAscNumFormatType.Time == nFormatType && res.bTime)) && res.format != oNumFormat.sFormat)
this.cell.setNumFormat(res.format);
this.number = res.value;
this.type = CellValueType.Number;
bParsed = true;
}
if(false == bParsed)
else
{
this.type = CellValueType.String;
//проверяем 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