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
d327b3a2
Commit
d327b3a2
authored
Oct 17, 2017
by
konovalovsergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add PivotRecords to store CT_PivotCacheRecords records
parent
2a3e0367
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
874 additions
and
458 deletions
+874
-458
cell/model/FormulaObjects/parserFormula.js
cell/model/FormulaObjects/parserFormula.js
+91
-0
cell/model/PivotTables.js
cell/model/PivotTables.js
+766
-440
cell/model/Workbook.js
cell/model/Workbook.js
+17
-18
No files found.
cell/model/FormulaObjects/parserFormula.js
View file @
d327b3a2
...
...
@@ -943,6 +943,97 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
}
return
cErrorLocal
[
"
na
"
];
};
cError
.
prototype
.
getErrorTypeFromString
=
function
(
val
)
{
var
res
;
switch
(
val
)
{
case
cErrorOrigin
[
"
value
"
]:
{
res
=
cErrorType
.
wrong_value_type
;
break
;
}
case
cErrorOrigin
[
"
nil
"
]:
{
res
=
cErrorType
.
null_value
;
break
;
}
case
cErrorOrigin
[
"
div
"
]:
{
res
=
cErrorType
.
division_by_zero
;
break
;
}
case
cErrorOrigin
[
"
ref
"
]:
{
res
=
cErrorType
.
bad_reference
;
break
;
}
case
cErrorOrigin
[
"
name
"
]:
{
res
=
cErrorType
.
wrong_name
;
break
;
}
case
cErrorOrigin
[
"
num
"
]:
{
res
=
cErrorType
.
not_numeric
;
break
;
}
case
cErrorOrigin
[
"
na
"
]:
{
res
=
cErrorType
.
not_available
;
break
;
}
case
cErrorOrigin
[
"
getdata
"
]:
{
res
=
cErrorType
.
getting_data
;
break
;
}
case
cErrorOrigin
[
"
uf
"
]:
{
res
=
cErrorType
.
unsupported_function
;
break
;
}
default
:
{
res
=
cErrorType
.
not_available
;
break
;
}
}
return
res
;
};
cError
.
prototype
.
getStringFromErrorType
=
function
(
type
)
{
var
res
;
switch
(
type
)
{
case
cErrorType
.
wrong_value_type
:
{
res
=
cErrorOrigin
[
"
value
"
];
break
;
}
case
cErrorType
.
null_value
:
{
res
=
cErrorOrigin
[
"
nil
"
];
break
;
}
case
cErrorType
.
division_by_zero
:
{
res
=
cErrorOrigin
[
"
div
"
];
break
;
}
case
cErrorType
.
bad_reference
:
{
res
=
cErrorOrigin
[
"
ref
"
];
break
;
}
case
cErrorType
.
wrong_name
:
{
res
=
cErrorOrigin
[
"
name
"
];
break
;
}
case
cErrorType
.
not_numeric
:
{
res
=
cErrorOrigin
[
"
num
"
];
break
;
}
case
cErrorType
.
not_available
:
{
res
=
cErrorOrigin
[
"
na
"
];
break
;
}
case
cErrorType
.
getting_data
:
{
res
=
cErrorOrigin
[
"
getdata
"
];
break
;
}
case
cErrorType
.
unsupported_function
:
{
res
=
cErrorOrigin
[
"
uf
"
];
break
;
}
default
:
res
=
cErrorType
.
not_available
;
break
;
}
return
res
;
};
/**
* @constructor
...
...
cell/model/PivotTables.js
View file @
d327b3a2
This diff is collapsed.
Click to expand it.
cell/model/Workbook.js
View file @
d327b3a2
...
...
@@ -5044,7 +5044,7 @@
};
Worksheet
.
prototype
.
_updatePivotTable
=
function
(
pivotTable
,
cleanRanges
)
{
var
pos
,
cells
,
index
,
i
,
j
,
k
,
r
,
c1
,
r1
,
field
,
indexField
,
cacheIndex
,
sharedItem
,
item
,
items
,
setName
,
oCellValue
,
cacheRecord
,
last
;
oCellValue
,
rowIndexes
,
last
;
for
(
i
=
0
;
i
<
cleanRanges
.
length
;
++
i
)
{
cleanRanges
[
i
].
cleanAll
();
}
...
...
@@ -5088,7 +5088,7 @@
for
(
i
=
0
;
i
<
items
.
length
;
++
i
)
{
item
=
items
[
i
];
r
=
item
.
getR
();
cacheRecord
=
cacheRecords
;
rowIndexes
=
undefined
;
if
(
countC
)
{
for
(
j
=
0
;
j
<
item
.
x
.
length
;
++
j
)
{
if
(
AscCommonExcel
.
c_oAscItemType
.
Grand
===
item
.
t
)
{
...
...
@@ -5111,7 +5111,7 @@
}
if
(
countD
)
{
cacheRecord
=
pivotTable
.
getValues
(
cacheRecord
,
indexField
,
cacheIndex
.
x
);
rowIndexes
=
pivotTable
.
getValues
(
cacheRecords
,
rowIndexes
,
indexField
,
cacheIndex
.
x
);
}
}
...
...
@@ -5132,7 +5132,7 @@
cacheFields
[
index
].
asc_getName
());
}
if
(
countD
)
{
cacheValuesCol
.
push
(
cacheRecord
);
cacheValuesCol
.
push
(
rowIndexes
);
}
}
}
...
...
@@ -5207,20 +5207,19 @@
last
=
r
===
countR
-
1
||
null
!==
item
.
t
;
if
(
countD
&&
(
last
||
(
field
&&
field
.
asc_getSubtotalTop
())))
{
for
(
j
=
0
;
j
<
cacheValuesCol
.
length
;
++
j
)
{
if
(
cacheRecord
=
cacheValuesCol
[
j
])
{
for
(
k
=
0
;
k
<
cacheValuesRow
.
length
&&
0
!==
cacheRecord
.
length
;
k
+=
2
)
{
cacheRecord
=
pivotTable
.
getValues
(
cacheRecord
,
cacheValuesRow
[
k
],
cacheValuesRow
[
k
+
1
]);
}
if
(
0
!==
cacheRecord
.
length
)
{
cells
=
this
.
getRange4
(
r1
+
i
,
rowFieldsPos
[
r
]
+
1
+
j
);
oCellValue
=
new
AscCommonExcel
.
CCellValue
();
oCellValue
.
number
=
pivotTable
.
getValue
(
cacheRecord
,
dataFields
[
0
].
asc_getIndex
(),
(
null
!==
item
.
t
&&
c_oAscItemType
.
Grand
!==
item
.
t
)
?
item
.
t
:
dataFields
[
0
].
asc_getSubtotal
());
oCellValue
.
type
=
AscCommon
.
CellValueType
.
Number
;
cells
.
setValueData
(
new
AscCommonExcel
.
UndoRedoData_CellValueData
(
null
,
oCellValue
));
}
rowIndexes
=
cacheValuesCol
[
j
];
for
(
k
=
0
;
k
<
cacheValuesRow
.
length
&&
(
!
rowIndexes
||
0
!==
rowIndexes
.
length
);
k
+=
2
)
{
rowIndexes
=
pivotTable
.
getValues
(
cacheRecords
,
rowIndexes
,
cacheValuesRow
[
k
],
cacheValuesRow
[
k
+
1
]);
}
if
(
0
!==
rowIndexes
.
length
)
{
cells
=
this
.
getRange4
(
r1
+
i
,
rowFieldsPos
[
r
]
+
1
+
j
);
oCellValue
=
new
AscCommonExcel
.
CCellValue
();
oCellValue
.
number
=
pivotTable
.
getValue
(
cacheRecords
,
rowIndexes
,
dataFields
[
0
].
asc_getIndex
(),
(
null
!==
item
.
t
&&
c_oAscItemType
.
Grand
!==
item
.
t
)
?
item
.
t
:
dataFields
[
0
].
asc_getSubtotal
());
oCellValue
.
type
=
AscCommon
.
CellValueType
.
Number
;
cells
.
setValueData
(
new
AscCommonExcel
.
UndoRedoData_CellValueData
(
null
,
oCellValue
));
}
}
if
(
last
)
{
...
...
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