Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
d10202a8
Commit
d10202a8
authored
May 23, 2017
by
Sergey Konovalov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug 34977
parent
fe07d8b5
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
137 additions
and
94 deletions
+137
-94
cell/model/History.js
cell/model/History.js
+2
-2
cell/model/UndoRedo.js
cell/model/UndoRedo.js
+4
-4
cell/model/Workbook.js
cell/model/Workbook.js
+10
-9
cell/model/WorkbookElems.js
cell/model/WorkbookElems.js
+45
-79
common/NumFormat.js
common/NumFormat.js
+76
-0
No files found.
cell/model/History.js
View file @
d10202a8
...
...
@@ -94,11 +94,11 @@ function (window, undefined) {
window
[
'
AscCH
'
].
historyitem_RowCol_Border
=
12
;
window
[
'
AscCH
'
].
historyitem_RowCol_ShrinkToFit
=
13
;
window
[
'
AscCH
'
].
historyitem_RowCol_Wrap
=
14
;
window
[
'
AscCH
'
].
historyitem_RowCol_NumFormat
=
15
;
window
[
'
AscCH
'
].
historyitem_RowCol_SetFont
=
16
;
window
[
'
AscCH
'
].
historyitem_RowCol_Angle
=
17
;
window
[
'
AscCH
'
].
historyitem_RowCol_SetStyle
=
18
;
window
[
'
AscCH
'
].
historyitem_RowCol_SetCellStyle
=
19
;
window
[
'
AscCH
'
].
historyitem_RowCol_Num
=
20
;
window
[
'
AscCH
'
].
historyitem_Cell_Fontname
=
1
;
window
[
'
AscCH
'
].
historyitem_Cell_Fontsize
=
2
;
...
...
@@ -114,7 +114,6 @@ function (window, undefined) {
window
[
'
AscCH
'
].
historyitem_Cell_Border
=
12
;
window
[
'
AscCH
'
].
historyitem_Cell_ShrinkToFit
=
13
;
window
[
'
AscCH
'
].
historyitem_Cell_Wrap
=
14
;
window
[
'
AscCH
'
].
historyitem_Cell_Numformat
=
15
;
window
[
'
AscCH
'
].
historyitem_Cell_ChangeValue
=
16
;
window
[
'
AscCH
'
].
historyitem_Cell_ChangeArrayValueFormat
=
17
;
window
[
'
AscCH
'
].
historyitem_Cell_SetStyle
=
18
;
...
...
@@ -123,6 +122,7 @@ function (window, undefined) {
window
[
'
AscCH
'
].
historyitem_Cell_Angle
=
21
;
window
[
'
AscCH
'
].
historyitem_Cell_Style
=
22
;
window
[
'
AscCH
'
].
historyitem_Cell_ChangeValueUndo
=
23
;
window
[
'
AscCH
'
].
historyitem_Cell_Num
=
24
;
window
[
'
AscCH
'
].
historyitem_Comment_Add
=
1
;
window
[
'
AscCH
'
].
historyitem_Comment_Remove
=
2
;
...
...
cell/model/UndoRedo.js
View file @
d10202a8
...
...
@@ -3010,8 +3010,8 @@ UndoRedoCell.prototype = {
cell
.
setFill
(
Val
);
else
if
(
AscCH
.
historyitem_Cell_Wrap
==
Type
)
cell
.
setWrap
(
Val
);
else
if
(
AscCH
.
historyitem_Cell_Num
format
==
Type
)
cell
.
setNum
Format
(
Val
);
else
if
(
AscCH
.
historyitem_Cell_Num
==
Type
)
cell
.
setNum
(
Val
);
else
if
(
AscCH
.
historyitem_Cell_Angle
==
Type
)
cell
.
setAngle
(
Val
);
else
if
(
AscCH
.
historyitem_Cell_ChangeArrayValueFormat
==
Type
)
...
...
@@ -3669,8 +3669,8 @@ UndoRedoRowCol.prototype = {
row
.
setShrinkToFit
(
Val
);
else
if
(
AscCH
.
historyitem_RowCol_Wrap
==
Type
)
row
.
setWrap
(
Val
);
else
if
(
AscCH
.
historyitem_RowCol_Num
Format
==
Type
)
row
.
setNum
Format
(
Val
);
else
if
(
AscCH
.
historyitem_RowCol_Num
==
Type
)
row
.
setNum
(
Val
);
else
if
(
AscCH
.
historyitem_RowCol_Angle
==
Type
)
row
.
setAngle
(
Val
);
else
if
(
AscCH
.
historyitem_RowCol_SetStyle
==
Type
)
...
...
cell/model/Workbook.js
View file @
d10202a8
...
...
@@ -4973,15 +4973,16 @@ Woorksheet.prototype.isApplyFilterBySheet = function(){
this
.
oValue
.
cleanCache
();
};
Cell
.
prototype
.
setNumFormat
=
function
(
val
){
var
oRes
;
/*if( val == aStandartNumFormats[0] &&
this.formulaParsed && this.formulaParsed.value && this.formulaParsed.value.numFormat !== null &&
this.formulaParsed.value.numFormat !== undefined && aStandartNumFormats[this.formulaParsed.value.numFormat] )
oRes = this.ws.workbook.oStyleManager.setNumFormat(this, aStandartNumFormats[this.formulaParsed.value.numFormat]);
else*/
oRes
=
this
.
ws
.
workbook
.
oStyleManager
.
setNumFormat
(
this
,
val
);
var
oRes
=
this
.
ws
.
workbook
.
oStyleManager
.
setNumFormat
(
this
,
val
);
if
(
History
.
Is_On
()
&&
oRes
.
oldVal
!=
oRes
.
newVal
)
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoCell
,
AscCH
.
historyitem_Cell_Numformat
,
this
.
ws
.
getId
(),
new
Asc
.
Range
(
this
.
nCol
,
this
.
nRow
,
this
.
nCol
,
this
.
nRow
),
new
UndoRedoData_CellSimpleData
(
this
.
nRow
,
this
.
nCol
,
oRes
.
oldVal
,
oRes
.
newVal
));
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoCell
,
AscCH
.
historyitem_Cell_Num
,
this
.
ws
.
getId
(),
new
Asc
.
Range
(
this
.
nCol
,
this
.
nRow
,
this
.
nCol
,
this
.
nRow
),
new
UndoRedoData_CellSimpleData
(
this
.
nRow
,
this
.
nCol
,
oRes
.
oldVal
,
oRes
.
newVal
));
this
.
compiledXfs
=
null
;
this
.
oValue
.
cleanCache
();
};
Cell
.
prototype
.
setNum
=
function
(
val
){
var
oRes
=
this
.
ws
.
workbook
.
oStyleManager
.
setNum
(
this
,
val
);
if
(
History
.
Is_On
()
&&
oRes
.
oldVal
!=
oRes
.
newVal
)
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoCell
,
AscCH
.
historyitem_Cell_Num
,
this
.
ws
.
getId
(),
new
Asc
.
Range
(
this
.
nCol
,
this
.
nRow
,
this
.
nCol
,
this
.
nRow
),
new
UndoRedoData_CellSimpleData
(
this
.
nRow
,
this
.
nCol
,
oRes
.
oldVal
,
oRes
.
newVal
));
this
.
compiledXfs
=
null
;
this
.
oValue
.
cleanCache
();
};
...
...
@@ -5315,7 +5316,7 @@ Woorksheet.prototype.isApplyFilterBySheet = function(){
var
valueCalc
=
this
.
formulaParsed
.
value
;
if
(
0
<=
valueCalc
.
numFormat
)
{
if
(
aStandartNumFormatsId
[
this
.
getNumFormatStr
()]
==
0
)
{
this
.
setNum
Format
(
aStandartNumFormats
[
valueCalc
.
numFormat
]
);
this
.
setNum
(
new
AscCommonExcel
.
Num
({
id
:
valueCalc
.
numFormat
})
);
}
}
else
if
(
AscCommonExcel
.
cNumFormatFirstCell
===
valueCalc
.
numFormat
)
{
// ищет в формуле первый рэндж и устанавливает формат ячейки как формат первой ячейки в рэндже
...
...
cell/model/WorkbookElems.js
View file @
d10202a8
...
...
@@ -1201,7 +1201,8 @@ var g_oBorderProperties = {
(
this
.
dd
&&
c_oAscBorderStyles
.
None
!==
this
.
dd
.
s
)
||
(
this
.
du
&&
c_oAscBorderStyles
.
None
!==
this
.
du
.
s
);
};
var
g_oNumProperties
=
{
f
:
0
f
:
0
,
id
:
1
};
/** @constructor */
function
Num
(
val
)
...
...
@@ -1219,78 +1220,7 @@ Num.prototype =
this
.
id
=
opt_id
;
},
getFormat
:
function
()
{
var
res
=
this
.
f
;
if
(
null
!=
this
.
id
)
{
if
(
15
<=
this
.
id
&&
this
.
id
<=
17
)
{
switch
(
this
.
id
)
{
case
15
:
res
=
AscCommon
.
getShortDateMonthFormat
(
true
,
true
,
null
);
break
;
case
16
:
res
=
AscCommon
.
getShortDateMonthFormat
(
true
,
false
,
null
);
break
;
case
17
:
res
=
AscCommon
.
getShortDateMonthFormat
(
false
,
true
,
null
);
break
;
}
}
else
{
//todo currencyLocale true/false?
var
currencyLocale
=
true
;
switch
(
this
.
id
)
{
case
5
:
res
=
AscCommon
.
getCurrencyFormatSimple
(
null
,
0
,
true
,
currencyLocale
,
false
);
break
;
case
6
:
res
=
AscCommon
.
getCurrencyFormatSimple
(
null
,
0
,
true
,
currencyLocale
,
true
);
break
;
case
7
:
res
=
AscCommon
.
getCurrencyFormatSimple
(
null
,
2
,
true
,
currencyLocale
,
false
);
break
;
case
8
:
res
=
AscCommon
.
getCurrencyFormatSimple
(
null
,
2
,
true
,
currencyLocale
,
true
);
break
;
case
14
:
res
=
AscCommon
.
getShortDateFormat
(
null
);
break
;
case
22
:
res
=
AscCommon
.
getShortDateFormat
(
null
)
+
"
h:mm
"
;
break
;
case
27
:
case
28
:
case
29
:
case
30
:
case
31
:
case
36
:
res
=
AscCommon
.
getShortDateFormat
(
null
);
break
;
case
37
:
res
=
AscCommon
.
getCurrencyFormatSimple
(
null
,
0
,
false
,
currencyLocale
,
false
);
break
;
case
38
:
res
=
AscCommon
.
getCurrencyFormatSimple
(
null
,
0
,
false
,
currencyLocale
,
true
);
break
;
case
39
:
res
=
AscCommon
.
getCurrencyFormatSimple
(
null
,
2
,
false
,
currencyLocale
,
false
);
break
;
case
40
:
res
=
AscCommon
.
getCurrencyFormatSimple
(
null
,
2
,
false
,
currencyLocale
,
true
);
break
;
case
41
:
res
=
AscCommon
.
getCurrencyFormat
(
null
,
0
,
false
,
currencyLocale
);
break
;
case
42
:
res
=
AscCommon
.
getCurrencyFormat
(
null
,
0
,
true
,
currencyLocale
);
break
;
case
43
:
res
=
AscCommon
.
getCurrencyFormat
(
null
,
2
,
false
,
currencyLocale
);
break
;
case
44
:
res
=
AscCommon
.
getCurrencyFormat
(
null
,
2
,
true
,
currencyLocale
);
break
;
}
}
}
return
res
;
return
(
null
!=
this
.
id
)
?
(
AscCommon
.
getFormatByStandardId
(
this
.
id
)
||
this
.
f
)
:
this
.
f
;
},
_mergeProperty
:
function
(
first
,
second
,
def
)
{
...
...
@@ -1349,14 +1279,16 @@ Num.prototype =
{
switch
(
nType
)
{
case
this
.
Properties
.
f
:
return
this
.
getFormat
();
break
;
case
this
.
Properties
.
f
:
return
this
.
f
;
break
;
case
this
.
Properties
.
id
:
return
this
.
id
;
break
;
}
},
setProperty
:
function
(
nType
,
value
)
{
switch
(
nType
)
{
case
this
.
Properties
.
f
:
this
.
setFormat
(
value
);
break
;
case
this
.
Properties
.
f
:
this
.
f
=
value
;
break
;
case
this
.
Properties
.
id
:
this
.
id
=
value
;
break
;
}
}
};
...
...
@@ -1931,6 +1863,28 @@ StyleManager.prototype =
}
return
oRes
;
},
setNum
:
function
(
oItemWithXfs
,
val
)
{
var
xfs
=
oItemWithXfs
.
xfs
;
var
oRes
=
{
newVal
:
val
,
oldVal
:
null
};
if
(
null
!=
xfs
&&
null
!=
xfs
.
num
)
oRes
.
oldVal
=
xfs
.
num
;
else
oRes
.
oldVal
=
null
;
if
(
null
==
val
)
{
if
(
null
!=
xfs
)
{
xfs
=
this
.
_prepareSetReference
(
oItemWithXfs
);
xfs
.
num
=
null
;
}
}
else
{
xfs
=
this
.
_prepareSet
(
oItemWithXfs
);
xfs
.
num
=
val
.
clone
();
}
return
oRes
;
},
setFont
:
function
(
oItemWithXfs
,
val
,
oHistoryObj
,
nHistoryId
,
sSheetId
,
oRange
)
{
var
xfs
=
oItemWithXfs
.
xfs
;
...
...
@@ -2577,9 +2531,15 @@ Col.prototype =
},
setNumFormat
:
function
(
val
)
{
var
oRes
=
this
.
ws
.
workbook
.
oStyleManager
.
setNum
Format
(
this
,
val
);
var
oRes
=
this
.
ws
.
workbook
.
oStyleManager
.
setNum
(
this
,
new
Num
({
f
:
val
})
);
if
(
History
.
Is_On
()
&&
oRes
.
oldVal
!=
oRes
.
newVal
)
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoCol
,
AscCH
.
historyitem_RowCol_NumFormat
,
this
.
ws
.
getId
(),
this
.
_getUpdateRange
(),
new
UndoRedoData_IndexSimpleProp
(
this
.
index
,
false
,
oRes
.
oldVal
,
oRes
.
newVal
));
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoCol
,
AscCH
.
historyitem_RowCol_Num
,
this
.
ws
.
getId
(),
this
.
_getUpdateRange
(),
new
UndoRedoData_IndexSimpleProp
(
this
.
index
,
false
,
oRes
.
oldVal
,
oRes
.
newVal
));
},
setNum
:
function
(
val
)
{
var
oRes
=
this
.
ws
.
workbook
.
oStyleManager
.
setNum
(
this
,
val
);
if
(
History
.
Is_On
()
&&
oRes
.
oldVal
!=
oRes
.
newVal
)
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoCol
,
AscCH
.
historyitem_RowCol_Num
,
this
.
ws
.
getId
(),
this
.
_getUpdateRange
(),
new
UndoRedoData_IndexSimpleProp
(
this
.
index
,
false
,
oRes
.
oldVal
,
oRes
.
newVal
));
},
setFont
:
function
(
val
)
{
...
...
@@ -2856,9 +2816,15 @@ Row.prototype =
},
setNumFormat
:
function
(
val
)
{
var
oRes
=
this
.
ws
.
workbook
.
oStyleManager
.
setNumFormat
(
this
,
val
);
var
oRes
=
this
.
ws
.
workbook
.
oStyleManager
.
setNum
(
this
,
new
Num
({
f
:
val
}));
if
(
History
.
Is_On
()
&&
oRes
.
oldVal
!=
oRes
.
newVal
)
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoRow
,
AscCH
.
historyitem_RowCol_Num
,
this
.
ws
.
getId
(),
this
.
_getUpdateRange
(),
new
UndoRedoData_IndexSimpleProp
(
this
.
index
,
true
,
oRes
.
oldVal
,
oRes
.
newVal
));
},
setNum
:
function
(
val
)
{
var
oRes
=
this
.
ws
.
workbook
.
oStyleManager
.
setNum
(
this
,
val
);
if
(
History
.
Is_On
()
&&
oRes
.
oldVal
!=
oRes
.
newVal
)
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoRow
,
AscCH
.
historyitem_RowCol_NumFormat
,
this
.
ws
.
getId
(),
this
.
_getUpdateRange
(),
new
UndoRedoData_IndexSimpleProp
(
this
.
index
,
true
,
oRes
.
oldVal
,
oRes
.
newVal
));
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoRow
,
AscCH
.
historyitem_RowCol_Num
,
this
.
ws
.
getId
(),
this
.
_getUpdateRange
(),
new
UndoRedoData_IndexSimpleProp
(
this
.
index
,
true
,
oRes
.
oldVal
,
oRes
.
newVal
));
},
setFont
:
function
(
val
)
{
...
...
common/NumFormat.js
View file @
d10202a8
...
...
@@ -4159,6 +4159,81 @@ function setCurrentCultureInfo(val) {
}
return
res
;
}
function
getFormatByStandardId
(
id
)
{
var
res
=
null
;
if
(
15
<=
id
&&
id
<=
17
)
{
switch
(
id
)
{
case
15
:
res
=
AscCommon
.
getShortDateMonthFormat
(
true
,
true
,
null
);
break
;
case
16
:
res
=
AscCommon
.
getShortDateMonthFormat
(
true
,
false
,
null
);
break
;
case
17
:
res
=
AscCommon
.
getShortDateMonthFormat
(
false
,
true
,
null
);
break
;
}
}
else
{
//todo currencyLocale true/false?
var
currencyLocale
=
true
;
switch
(
id
)
{
case
5
:
res
=
AscCommon
.
getCurrencyFormatSimple
(
null
,
0
,
true
,
currencyLocale
,
false
);
break
;
case
6
:
res
=
AscCommon
.
getCurrencyFormatSimple
(
null
,
0
,
true
,
currencyLocale
,
true
);
break
;
case
7
:
res
=
AscCommon
.
getCurrencyFormatSimple
(
null
,
2
,
true
,
currencyLocale
,
false
);
break
;
case
8
:
res
=
AscCommon
.
getCurrencyFormatSimple
(
null
,
2
,
true
,
currencyLocale
,
true
);
break
;
case
14
:
res
=
AscCommon
.
getShortDateFormat
(
null
);
break
;
case
22
:
res
=
AscCommon
.
getShortDateFormat
(
null
)
+
"
h:mm
"
;
break
;
case
27
:
case
28
:
case
29
:
case
30
:
case
31
:
case
36
:
res
=
AscCommon
.
getShortDateFormat
(
null
);
break
;
case
37
:
res
=
AscCommon
.
getCurrencyFormatSimple
(
null
,
0
,
false
,
currencyLocale
,
false
);
break
;
case
38
:
res
=
AscCommon
.
getCurrencyFormatSimple
(
null
,
0
,
false
,
currencyLocale
,
true
);
break
;
case
39
:
res
=
AscCommon
.
getCurrencyFormatSimple
(
null
,
2
,
false
,
currencyLocale
,
false
);
break
;
case
40
:
res
=
AscCommon
.
getCurrencyFormatSimple
(
null
,
2
,
false
,
currencyLocale
,
true
);
break
;
case
41
:
res
=
AscCommon
.
getCurrencyFormat
(
null
,
0
,
false
,
currencyLocale
);
break
;
case
42
:
res
=
AscCommon
.
getCurrencyFormat
(
null
,
0
,
true
,
currencyLocale
);
break
;
case
43
:
res
=
AscCommon
.
getCurrencyFormat
(
null
,
2
,
false
,
currencyLocale
);
break
;
case
44
:
res
=
AscCommon
.
getCurrencyFormat
(
null
,
2
,
true
,
currencyLocale
);
break
;
default
:
res
=
AscCommonExcel
.
aStandartNumFormats
[
id
];
break
;
}
}
return
res
;
}
var
g_aCultureInfos
=
{
1029
:
{
LCID
:
1029
,
Name
:
"
cs-CZ
"
,
CurrencyPositivePattern
:
3
,
CurrencyNegativePattern
:
8
,
CurrencySymbol
:
"
Kč
"
,
NumberDecimalSeparator
:
"
,
"
,
NumberGroupSeparator
:
"
"
,
NumberGroupSizes
:
[
3
],
DayNames
:
[
"
neděle
"
,
"
pondělí
"
,
"
úterý
"
,
"
středa
"
,
"
čtvrtek
"
,
"
pátek
"
,
"
sobota
"
],
AbbreviatedDayNames
:
[
"
ne
"
,
"
po
"
,
"
út
"
,
"
st
"
,
"
čt
"
,
"
pá
"
,
"
so
"
],
MonthNames
:
[
"
leden
"
,
"
únor
"
,
"
březen
"
,
"
duben
"
,
"
květen
"
,
"
červen
"
,
"
červenec
"
,
"
srpen
"
,
"
září
"
,
"
říjen
"
,
"
listopad
"
,
"
prosinec
"
,
""
],
AbbreviatedMonthNames
:
[
"
led
"
,
"
úno
"
,
"
bře
"
,
"
dub
"
,
"
kvě
"
,
"
čvn
"
,
"
čvc
"
,
"
srp
"
,
"
zář
"
,
"
říj
"
,
"
lis
"
,
"
pro
"
,
""
],
MonthGenitiveNames
:
[
"
ledna
"
,
"
února
"
,
"
března
"
,
"
dubna
"
,
"
května
"
,
"
června
"
,
"
července
"
,
"
srpna
"
,
"
září
"
,
"
října
"
,
"
listopadu
"
,
"
prosince
"
,
""
],
AbbreviatedMonthGenitiveNames
:
[],
AMDesignator
:
"
dop.
"
,
PMDesignator
:
"
odp.
"
,
DateSeparator
:
"
.
"
,
TimeSeparator
:
"
:
"
,
ShortDatePattern
:
"
135
"
},
...
...
@@ -4204,6 +4279,7 @@ var g_oDefaultCultureInfo = g_aCultureInfos[1033];//en-US//1033//fr-FR//1036//ba
window
[
'
AscCommon
'
].
getCurrencyFormatSimple2
=
getCurrencyFormatSimple2
;
window
[
'
AscCommon
'
].
getCurrencyFormat
=
getCurrencyFormat
;
window
[
'
AscCommon
'
].
getFormatCells
=
getFormatCells
;
window
[
'
AscCommon
'
].
getFormatByStandardId
=
getFormatByStandardId
;
window
[
"
AscCommon
"
].
gc_nMaxDigCount
=
gc_nMaxDigCount
;
window
[
"
AscCommon
"
].
gc_nMaxDigCountView
=
gc_nMaxDigCountView
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment