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
4cc453b5
Commit
4cc453b5
authored
May 13, 2016
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support text values for colorscale
parent
0ff5d20d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
26 deletions
+46
-26
cell/model/Workbook.js
cell/model/Workbook.js
+46
-26
No files found.
cell/model/Workbook.js
View file @
4cc453b5
...
...
@@ -1898,6 +1898,13 @@ function angleInterfaceToFormat(val)
nRes
=
0
;
return
nRes
;
}
function
getUniqueKeys
(
array
)
{
var
i
,
o
=
{};
for
(
i
=
0
;
i
<
array
.
length
;
++
i
)
{
o
[
array
[
i
]]
=
!
o
.
hasOwnProperty
(
array
[
i
]);
}
return
o
;
}
//-------------------------------------------------------------------------------------------------
/**
* @constructor
...
...
@@ -3472,13 +3479,24 @@ Woorksheet.prototype.initPostOpen = function(handlers){
this
.
handlers
=
handlers
;
this
.
_setHandlersTablePart
();
};
Woorksheet
.
prototype
.
_getValuesForConditionalFormatting
=
function
(
sqref
)
{
var
aValues
=
[],
aCells
=
[];
var
tmp
;
this
.
getRange3
(
sqref
.
r1
,
sqref
.
c1
,
sqref
.
r2
,
sqref
.
c2
).
_setPropertyNoEmpty
(
null
,
null
,
function
(
c
)
{
if
(
!
c
.
isEmptyTextString
())
{
aCells
.
push
(
c
);
aValues
.
push
(
c
.
getValueWithoutFormat
());
}
});
return
{
c
:
aCells
,
v
:
aValues
};
};
Woorksheet
.
prototype
.
_updateConditionalFormatting
=
function
(
range
)
{
var
oGradient
=
null
;
var
aCFs
=
this
.
aConditionalFormatting
;
var
aRules
,
oRule
;
var
oRuleElement
=
null
;
var
aValues
=
[],
aCells
=
[]
;
var
tmp
,
i
,
j
,
cell
,
sqre
f
;
var
o
;
var
i
,
j
,
cell
,
sqref
,
values
,
tmp
,
min
,
max
,
dx
f
;
for
(
i
=
0
;
i
<
aCFs
.
length
;
++
i
)
{
sqref
=
aCFs
[
i
].
sqref
;
// ToDo убрать null === sqref когда научимся мультиселект обрабатывать (\\192.168.5.2\source\DOCUMENTS\XLSX\Matematika Quantum Sedekah.xlsx)
...
...
@@ -3490,17 +3508,6 @@ Woorksheet.prototype._updateConditionalFormatting = function(range) {
for
(
j
=
0
;
j
<
aRules
.
length
;
++
j
)
{
oRule
=
aRules
[
j
];
this
.
getRange3
(
sqref
.
r1
,
sqref
.
c1
,
sqref
.
r2
,
sqref
.
c2
).
_setPropertyNoEmpty
(
null
,
null
,
function
(
c
)
{
if
(
CellValueType
.
Number
===
c
.
getType
()
&&
false
===
c
.
isEmptyTextString
())
{
tmp
=
parseFloat
(
c
.
getValueWithoutFormat
());
if
(
isNaN
(
tmp
))
{
return
;
}
aCells
.
push
(
c
);
aValues
.
push
(
tmp
);
}
});
// ToDo aboveAverage, beginsWith, cellIs, containsBlanks, containsErrors,
// ToDo containsText, dataBar, duplicateValues, endsWith, expression, iconSet, notContainsBlanks,
// ToDo notContainsErrors, notContainsText, timePeriod, top10, uniqueValues (page 2679)
...
...
@@ -3513,26 +3520,39 @@ Woorksheet.prototype._updateConditionalFormatting = function(range) {
if
(
!
(
oRuleElement
instanceof
AscCommonExcel
.
CColorScale
))
{
break
;
}
min
=
Number
.
MAX_VALUE
;
max
=
-
Number
.
MAX_VALUE
;
values
=
this
.
_getValuesForConditionalFormatting
(
sqref
);
for
(
cell
=
0
;
cell
<
values
.
v
.
length
;
++
cell
)
{
if
(
CellValueType
.
Number
===
values
.
c
[
cell
].
getType
()
&&
!
isNaN
(
tmp
=
parseFloat
(
values
.
v
[
cell
])))
{
values
.
v
[
cell
]
=
tmp
;
min
=
Math
.
min
(
min
,
tmp
);
max
=
Math
.
max
(
max
,
tmp
);
}
else
{
values
.
v
[
cell
]
=
null
;
}
}
// ToDo CFVO Type (formula, max, min, num, percent, percentile) (page 2681)
// ToDo support 3 colors in rule
if
(
0
<
aCells
.
length
&&
2
===
oRuleElement
.
aColors
.
length
)
{
if
(
0
<
values
.
c
.
length
&&
2
===
oRuleElement
.
aColors
.
length
)
{
oGradient
=
new
AscCommonExcel
.
CGradient
(
oRuleElement
.
aColors
[
0
],
oRuleElement
.
aColors
[
1
]);
oGradient
.
init
(
Math
.
min
.
apply
(
Math
,
aValues
),
Math
.
max
.
apply
(
Math
,
aValues
)
);
oGradient
.
init
(
min
,
max
);
for
(
cell
=
0
;
cell
<
aCells
.
length
;
++
cell
)
{
var
dxf
=
new
AscCommonExcel
.
CellXfs
();
dxf
.
fill
=
new
AscCommonExcel
.
Fill
({
bg
:
oGradient
.
calculateColor
(
aValues
[
cell
])});
aCells
[
cell
].
setConditionalFormattingStyle
(
dxf
);
for
(
cell
=
0
;
cell
<
values
.
c
.
length
;
++
cell
)
{
dxf
=
null
;
if
(
null
!==
values
.
v
[
cell
])
{
dxf
=
new
AscCommonExcel
.
CellXfs
();
dxf
.
fill
=
new
AscCommonExcel
.
Fill
({
bg
:
oGradient
.
calculateColor
(
values
.
v
[
cell
])});
}
values
.
c
[
cell
].
setConditionalFormattingStyle
(
dxf
);
}
}
break
;
case
Asc
.
ECfType
.
uniqueValues
:
o
=
getUniqueKeys
(
values
.
v
);
break
;
}
aCells
.
length
=
0
;
aValues
.
length
=
0
;
}
}
}
...
...
@@ -8811,7 +8831,7 @@ function _isSameSizeMerged(bbox, aMerged) {
}
}
return
oRes
;
}
;
}
function
_canPromote
(
from
,
wsFrom
,
to
,
wsTo
,
bIsPromote
,
nWidth
,
nHeight
,
bVertical
,
nIndex
)
{
var
oRes
=
{
oMergedFrom
:
null
,
oMergedTo
:
null
};
//если надо только удалить внутреннее содержимое не смотрим на замерженость
...
...
@@ -8844,7 +8864,7 @@ function _canPromote(from, wsFrom, to, wsTo, bIsPromote, nWidth, nHeight, bVerti
}
}
return
oRes
;
}
;
}
// Подготовка Copy Style
function
preparePromoteFromTo
(
from
,
to
)
{
var
bSuccess
=
true
;
...
...
@@ -8860,7 +8880,7 @@ function preparePromoteFromTo(from, to) {
}
else
bSuccess
=
false
;
return
bSuccess
;
}
;
}
// Перед promoteFromTo обязательно должна быть вызывана функция preparePromoteFromTo
function
promoteFromTo
(
from
,
wsFrom
,
to
,
wsTo
)
{
var
bVertical
=
true
;
...
...
@@ -8888,7 +8908,7 @@ function promoteFromTo(from, wsFrom, to, wsTo) {
wsTo
.
mergeManager
.
remove
(
to
,
true
);
_promoteFromTo
(
from
,
wsFrom
,
to
,
wsTo
,
false
,
oCanPromote
,
false
,
bVertical
,
nIndex
);
}
}
;
}
Range
.
prototype
.
promote
=
function
(
bCtrl
,
bVertical
,
nIndex
){
//todo отдельный метод для promote в таблицах и merge в таблицах
var
oBBox
=
this
.
bbox
;
...
...
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