Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pivot table calculation and the GetPivotData function support #1418

Merged
merged 139 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
74f71f1
Started work on the GetPivotData function
JanKallman Oct 31, 2023
65d6609
More work on Pivot table calculation
JanKallman Oct 31, 2023
bdb435b
Merge branch 'develop7' into feature/getpivotdata
JanKallman Nov 1, 2023
7c395db
Added support for basic calculation of pivot table formulas
JanKallman Nov 2, 2023
b7c750d
Added support for all pivot functions when calculating a pivot table
JanKallman Nov 3, 2023
b734e1c
Added basic support for pivot table - Show Data As
JanKallman Nov 8, 2023
5c8760d
Merge branch 'develop7' into feature/getpivotdata
JanKallman Nov 13, 2023
f76b8bb
WIP:More work on pivot calculation - Show value as
JanKallman Nov 14, 2023
4332bf9
WIP:More work on pivot calculation - Show value as
JanKallman Nov 14, 2023
a62c922
WIP: More work on Show as PercentOf
JanKallman Nov 15, 2023
e5e564a
Merge branch 'feature/getpivotdata' of https://github.com/EPPlusSoftw…
JanKallman Nov 15, 2023
dd3b173
WIP: Pivot table show value as
JanKallman Nov 17, 2023
a91a332
WIP:Added dictionary support for fields not in the row/col hierki
JanKallman Nov 20, 2023
cbd4fb2
Merge branch 'develop7' into feature/getpivotdata
JanKallman Nov 20, 2023
6247fd9
Merge branch 'develop7' into feature/getpivotdata
JanKallman Nov 22, 2023
db6a097
WIP:Support for % of Row/Column Total
JanKallman Nov 22, 2023
2200370
WIP:Tests
JanKallman Nov 23, 2023
3811791
Merge branch 'develop7' into feature/getpivotdata
JanKallman Nov 23, 2023
4f74412
Merge branch 'develop7' into feature/getpivotdata
JanKallman Nov 30, 2023
4f5adbd
WIP:PercentOf
JanKallman Nov 30, 2023
c2c499b
Merge branch 'develop7' into feature/getpivotdata
JanKallman Nov 30, 2023
a3c2b73
WIP:ShowAs Running Total
JanKallman Dec 4, 2023
1c6b570
Merge branch 'develop7' into feature/getpivotdata
JanKallman Dec 8, 2023
522dc97
Added new PivotCacheStore
JanKallman Dec 8, 2023
204bc2a
WIP:Pivot Calculation Store
JanKallman Dec 8, 2023
33b569c
WIP: Added tests for evaluation of pivot table caption filters
JanKallman Dec 13, 2023
364a6c3
WIP:More Tests for filters
JanKallman Dec 14, 2023
9d2e952
WIP:Added more test for Pivot Table Filters
JanKallman Dec 15, 2023
d124f00
Merge
JanKallman Dec 20, 2023
3e00384
WIP:Started on value filters
JanKallman Dec 21, 2023
445512f
Merge branch 'develop7' into feature/getpivotdata
JanKallman Dec 21, 2023
b9d6d58
Merge branch 'develop7' into feature/getpivotdata
JanKallman Dec 22, 2023
7ba7949
Merge branch 'develop7' into feature/getpivotdata
JanKallman Jan 3, 2024
d2029fd
WIP:Added new PivotCalculationStore
JanKallman Jan 3, 2024
1dc2539
WIP:Pivot Tabel Calculation
JanKallman Jan 5, 2024
f1648c8
WIP:GetPivotData
JanKallman Jan 8, 2024
c97e819
Merge branch 'develop7' into feature/getpivotdata
JanKallman Jan 9, 2024
af6d05f
WIP:Pivot Calculation Percent of
JanKallman Jan 10, 2024
3143fb3
Merge branch 'develop7' into feature/getpivotdata
JanKallman Jan 10, 2024
7bed7fb
WIP:RunningTotal
JanKallman Jan 11, 2024
326af6b
WIP:RunningTotal
JanKallman Jan 11, 2024
34d89b3
Merge branch 'develop7' into feature/getpivotdata
JanKallman Jan 15, 2024
5140d50
WIP: ShowAs Running Total
JanKallman Jan 18, 2024
ad4dc39
Merge branch 'develop7' into feature/getpivotdata
JanKallman Jan 18, 2024
c2a150d
WIP: ShowAs Rank Descending
JanKallman Jan 18, 2024
f33c2fe
WIP:Added ShowAsIndex
JanKallman Jan 19, 2024
197138e
Merge branch 'develop7' into feature/getpivotdata
JanKallman Jan 19, 2024
6f0ba4c
Merge branch 'develop7' into feature/getpivotdata
JanKallman Jan 29, 2024
e9e8d1a
WIP:ShowAs Index
JanKallman Jan 30, 2024
8ec43c4
Merge branch 'develop7' into feature/getpivotdata
JanKallman Jan 31, 2024
18194d9
Merge branch 'develop7' into feature/getpivotdata
JanKallman Jan 31, 2024
c296be3
WIP:Calculation of Date and Numeric Grouping
JanKallman Feb 7, 2024
53f61de
Merge
JanKallman Feb 8, 2024
83c2cca
WIP:Fixed grouping issues for failing tests
JanKallman Feb 8, 2024
a1ed8bd
WIP: Fixed some tests
JanKallman Feb 9, 2024
0aca974
WIP:Value Filter in calc
JanKallman Feb 12, 2024
eba3484
Merge branch 'develop7' into feature/getpivotdata
JanKallman Feb 15, 2024
e540b66
WIP:Added support for all value filter except top-bottom filters
JanKallman Feb 15, 2024
2f7a8fa
WIP:Added support for Top/Bottom filter
JanKallman Feb 16, 2024
40a36d2
WIP:Added support for Sum and Percent Top/Bottom filters
JanKallman Feb 19, 2024
f04106d
WIP:Calculate Pivot Table Grouping
JanKallman Feb 20, 2024
e4c55e8
Merge branch 'develop7' into feature/getpivotdata
JanKallman Feb 20, 2024
95c95a9
WIP:Added support for calculation of date and numeric groupings
JanKallman Feb 22, 2024
809b951
WIP:pt.ColumnFields.Add(pt.Fields[Continent]);
JanKallman Feb 23, 2024
ffef25e
WIP:Fixed some failing tests
JanKallman Feb 27, 2024
d9b2447
Merge branch 'develop7' into feature/getpivotdata
JanKallman Feb 27, 2024
4b03d49
Fixed copy issue of pivot tables.
JanKallman Feb 27, 2024
c5bb48c
WIP:Added tests for date grouping calculation
JanKallman Feb 28, 2024
47befcc
WIP:More work on calculating numeric groupings in pivot tables
JanKallman Mar 1, 2024
146c0b1
WIP:Fixed some issues with calculaing numeric and date grouping
JanKallman Mar 6, 2024
9f640d6
WIP:Fixed Tests
JanKallman Mar 6, 2024
bd65552
WIP:Added support sort.
JanKallman Mar 7, 2024
9c6b63f
WIP:Started work on pivot table field formulas calculation
JanKallman Mar 8, 2024
8220d98
Merge branch 'develop7' into feature/getpivotdata
JanKallman Mar 8, 2024
209feb8
Merge branch 'develop7' into feature/getpivotdata
JanKallman Mar 11, 2024
65fc390
Merge branch 'develop7' into feature/getpivotdata
JanKallman Mar 12, 2024
443ea41
WIP:Calculated pivot fields
JanKallman Mar 14, 2024
0695a91
WIP:Calculation of pivot fields
JanKallman Mar 15, 2024
7acf08f
WIP:Fixed reading of pivot records. Fixed a few bugs
JanKallman Mar 22, 2024
da073d5
Merge develop7
JanKallman Mar 25, 2024
5ebec91
Merge branch 'develop7' into feature/getpivotdata
JanKallman Mar 25, 2024
05fa9b5
WIP:Fixed cache comparer to match on strings. Fixed issue with calcul…
JanKallman Mar 26, 2024
8f942fe
WIP:Slicer filtering in Pivot Calculation.Merge develop7
JanKallman Apr 2, 2024
ed98103
Merge branch 'develop7' into feature/getpivotdata
JanKallman Apr 4, 2024
75e7576
WIP:Pivot table slicer filters in calculation
JanKallman Apr 5, 2024
ffafbcb
Merge branch 'develop7' into feature/getpivotdata
JanKallman Apr 5, 2024
14442a2
WIP:Work on Pivot Table Calculation
JanKallman Apr 8, 2024
853e073
Merge branch 'develop7' into feature/getpivotdata
JanKallman Apr 10, 2024
512294d
WIP:Fixed compile error. Removed tests
JanKallman Apr 10, 2024
299beb8
WIP:Fixed failing tests
JanKallman Apr 10, 2024
d644fd4
Fixed some issues and tests in the pivot calculation.
JanKallman Apr 12, 2024
ad63be1
Merge branch 'develop7' into feature/getpivotdata
JanKallman Apr 12, 2024
3a5cb4c
Merge branch 'develop7' into feature/getpivotdata
JanKallman Apr 16, 2024
4491011
Set ExcelPivotTable.GetPivotData to public. The GetPivotData method n…
JanKallman Apr 16, 2024
5d46199
Merge branch 'develop7' into feature/getpivotdata
JanKallman Apr 16, 2024
39366a0
Fixed Text replace issue
JanKallman Apr 16, 2024
6deddf3
Added more tests for multiple data fields of the same pivot field
JanKallman Apr 16, 2024
d645b92
Added CalculatedData property
JanKallman Apr 19, 2024
0628987
Added tests
JanKallman Apr 19, 2024
6d44ca2
Fixes issue #1421
JanKallman Apr 19, 2024
61967c3
Merge branch 'develop7' into feature/getpivotdata
JanKallman Apr 19, 2024
21cb69e
Added new Property CalculatedItems. Removed redundant property ExcelP…
JanKallman Apr 19, 2024
4245065
Merge branch 'develop7' into feature/getpivotdata
JanKallman Apr 19, 2024
042b410
Added calculation of multiple subtotals
JanKallman Apr 22, 2024
db16ab3
Added support for muliple subtotals on row/column fields
JanKallman Apr 23, 2024
728093a
Merge branch 'develop7' into feature/getpivotdata
JanKallman Apr 23, 2024
6dc5f36
Added new interface for class ExcelPivotTable.CalculatedData
JanKallman Apr 24, 2024
69e7d12
Added new aggregation to speed up performance.
JanKallman Apr 25, 2024
5ae8742
Fixed an issue with subtotal items. Added new tests for refreshing th…
JanKallman Apr 29, 2024
e5a350c
Merge branch 'develop7' into feature/getpivotdata
JanKallman Apr 30, 2024
711b9b9
Fixed some issues with aggregated keys on row/columns. Added tests.
JanKallman May 2, 2024
e20adf5
Merge branch 'develop7_2' into feature/getpivotdata
JanKallman May 3, 2024
4b0e09c
Fixed some failing tests
JanKallman May 3, 2024
ed38ddf
Minor refactoring
JanKallman May 3, 2024
13f4f79
Merge branch 'develop7_2' into feature/getpivotdata
JanKallman May 3, 2024
d49eb19
Removed commented out code. Updated headers to version 7.2
JanKallman May 3, 2024
a7bc05a
Made testbase unicode
OssianEPPlus May 8, 2024
dbcf13d
adding tests unfinished
OssianEPPlus May 8, 2024
30028ba
Added calculate to tests
OssianEPPlus May 13, 2024
c054b73
WIP:Added PivotShowAsDifference
JanKallman May 13, 2024
6afbb4a
Expanded tests
OssianEPPlus May 14, 2024
d7b43b0
Added missing ShowValueAs: Difference, DifferencePercent and PercentP…
JanKallman May 14, 2024
741803f
Restored PivotTableTests after merge
JanKallman May 14, 2024
85403ea
Further tests
OssianEPPlus May 14, 2024
bb32175
Merge branch 'feature/getpivotdata' of https://github.com/EPPlusSoftw…
OssianEPPlus May 14, 2024
9080bd9
Basefield fix
OssianEPPlus May 14, 2024
457299b
Fixed ShowAsDifferenceOf calculation
JanKallman May 16, 2024
d32168e
Merge fixes
JanKallman May 16, 2024
9677835
WIP:Redesign ShowAsDifference
JanKallman May 17, 2024
40d1e36
Some fixed on ShowAs-Difference
JanKallman May 20, 2024
a0d6f1d
WIP:Changed ShowAs Running Total calculation
JanKallman May 21, 2024
188a2da
Merge branch 'develop7_2' into feature/getpivotdata
JanKallman May 21, 2024
49afcbf
Fixed merge issue
JanKallman May 21, 2024
84d1b1f
Redesigned ShowAs-Running Total calculations.Added more tests
JanKallman May 22, 2024
4475f69
Merge develop7_2. Fixed merge issues in SourceCodeTokenizer
JanKallman May 22, 2024
c6cf0d5
Removed old comment
OssianEPPlus May 23, 2024
082c899
Fixes for pr comments
JanKallman May 23, 2024
2efb68b
Merge branch 'feature/getpivotdata' of https://github.com/EPPlusSoftw…
JanKallman May 23, 2024
8467870
Removed uncommented code
JanKallman May 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ internal class ExcelConditionalFormattingContainsText : ExcelConditionalFormatti

ExcelConditionalFormattingContainsText(ExcelConditionalFormattingContainsText copy, ExcelWorksheet newWs = null) :base(copy, newWs)
{
//Text = copy.Text;
}

internal override ExcelConditionalFormattingRule Clone(ExcelWorksheet newWs = null)
Expand Down
3 changes: 1 addition & 2 deletions src/EPPlus/Core/Worksheet/WorksheetCopyHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -819,11 +819,10 @@ private static void CopyPivotTable(ExcelWorksheet Copy, ExcelWorksheet added)
xmlDoc.LoadXml(xml);
xmlDoc.SelectSingleNode("//d:pivotTableDefinition/@name", tbl.NameSpaceManager).Value = name;

int Id = added._package.Workbook._nextPivotTableID++;
int Id = added.Workbook._nextPivotTableID++;
var uriTbl = XmlHelper.GetNewUri(added._package.ZipPackage, "/xl/pivotTables/pivotTable{0}.xml", ref Id);
if (added.Workbook._nextPivotTableID < Id) added.Workbook._nextPivotTableID = Id;

xmlDoc.SelectSingleNode("//d:pivotTableDefinition/@cacheId", tbl.NameSpaceManager).Value = Id.ToString();
xml = xmlDoc.OuterXml;

var partTbl = added._package.ZipPackage.CreatePart(uriTbl, ContentTypes.contentTypePivotTable, added._package.Compression);
Expand Down
2 changes: 1 addition & 1 deletion src/EPPlus/Drawing/Chart/ExcelChartAxis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public ExcelTextBody TextBody
}
ExcelDrawingTextSettings _textSettings = null;
/// <summary>
/// Text settings like fills, text outlines and effects
/// String settings like fills, text outlines and effects
/// </summary>
public ExcelDrawingTextSettings TextSettings
{
Expand Down
2 changes: 1 addition & 1 deletion src/EPPlus/Drawing/Chart/ExcelChartDataTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public ExcelTextBody TextBody
}
ExcelDrawingTextSettings _textSettings = null;
/// <summary>
/// Text settings like fills, text outlines and effects
/// String settings like fills, text outlines and effects
/// </summary>
public ExcelDrawingTextSettings TextSettings
{
Expand Down
2 changes: 1 addition & 1 deletion src/EPPlus/Drawing/Controls/enums/eLayoutFlow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace OfficeOpenXml.Drawing.Controls
{
/// <summary>
/// Text layout flow.
/// String layout flow.
/// </summary>
public enum eLayoutFlow
{
Expand Down
7 changes: 7 additions & 0 deletions src/EPPlus/ExcelAddressBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ internal enum eAddressCollition
internal ExcelAddressBase()
{
}
internal ExcelAddressBase(FormulaRangeAddress adr) : this(adr.WorksheetName,adr.FromRow, adr.FromCol, adr.ToRow, adr.ToCol)
{
_fromRowFixed = (adr.FixedFlag & FixedFlag.FromRowFixed) > 0;
_fromColFixed = (adr.FixedFlag & FixedFlag.FromColFixed) > 0;
_toRowFixed = (adr.FixedFlag & FixedFlag.ToRowFixed) > 0;
_toColFixed = (adr.FixedFlag & FixedFlag.ToColFixed) > 0;
}
/// <summary>
/// Creates an Address object
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/EPPlus/ExcelTextFormats/ExcelOutputTextFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public ExcelOutputTextFormat() : base()
/// </summary>
public string ThousandsSeparator { get; set; } = null;
/// <summary>
/// What to replace Text Qualifiers inside a text, when Text Qualifiers is set.
/// What to replace Text Qualifiers inside a text, when String Qualifiers is set.
/// Default is two Text Qualifiers characters. For example " is replaced with "".
/// </summary>
public string EncodedTextQualifiers { get; set; } = null;
Expand Down
5 changes: 3 additions & 2 deletions src/EPPlus/ExcelWorkbook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ private void SavePivotTableCaches()
{
foreach (var info in _pivotTableCaches.Values)
{
foreach (var cache in info.PivotCaches)
foreach (var cache in info.PivotCaches)
{
if (cache._pivotTables.Count == 0)
{
Expand All @@ -1346,6 +1346,7 @@ private void SavePivotTableCaches()
{
FixFieldNamesAndUpdateSharedItems(cache, t, fields);
}

cache.RefreshOnLoad = true;
cache.CacheDefinitionXml.Save(cache.Part.GetStream(FileMode.Create));
cache.ResetRecordXml(_package.ZipPackage);
Expand Down Expand Up @@ -1375,7 +1376,7 @@ private void FixFieldNamesAndUpdateSharedItems(PivotTableCacheInternal cache, Ex
}
flds.Add(fldName);
node.SetAttribute("name", fldName);
if (cache.Fields[ix].Grouping == null)
if (cache.Fields[ix].IsRowColumnOrPage || cache.Fields[ix].HasSlicer)
{
cache.Fields[ix].WriteSharedItems(node, NameSpaceManager);
}
Expand Down
6 changes: 3 additions & 3 deletions src/EPPlus/Filter/ExcelTop10FilterColumn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ internal ExcelTop10FilterColumn(XmlNamespaceManager namespaceManager, XmlNode to
{
FilterValue = GetXmlNodeDouble("d:top10/@filterVal");
Percent = GetXmlNodeBool("d:top10/@percent");
Top = GetXmlNodeBool("d:top10/@top");
Top = GetXmlNodeBool("d:top10/@top", true);
Value = GetXmlNodeDouble("d:top10/@val");
}
/// <summary>
Expand Down Expand Up @@ -120,11 +120,11 @@ internal override void SetFilterValue(ExcelWorksheet worksheet, ExcelAddressBase
{
if (Percent)
{
index = (int)((address._toRow-address._fromRow) * (valueInt/100D)) - 1;
index = (int)((address._toRow-address._fromRow) * (valueInt / 100D)) - 1;
}
else
{
index = valueInt-1;
index = valueInt - 1;
}
if (index < 0) index = 0;
FilterValue = index < items.Count ? items[index] : items[items.Count - 1];
Expand Down
2 changes: 1 addition & 1 deletion src/EPPlus/Filter/ExcelValueFilterCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public ExcelFilterDateGroupItem Add(ExcelFilterDateGroupItem value)
return value;
}
/// <summary>
/// <para>Add a filter value that will be matched agains the ExcelRange.Text property</para>
/// <para>Add a filter value that will be matched agains the ExcelRange.String property</para>
/// If value is "" or null sets Blank=True instead of adding.
/// </summary>
/// <param name="item">The value to add. If "" or null sets Blank=True instead.</param>
Expand Down