Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix error by two pivot with one source #1195 #1196
What's this PR do?
I created in MS Excel a file containing two Pivot on different sheets, the data source for which is a table with data. Then I opened this file in ClosedXML and changed the data in the data table and saved the file. When opening the received file, MS Excel displays an error:
The reason that in the pivotCacheDefinition the TaxRate field was not filled in was that the file was generated based on a template in which two summary tables are constructed from data from the same data table. In this case Excel creates one pivotCacheDefinition file, and ClosedXML while caches the last Pivot overwrites the cache for the first Pivot.
How should this be manually tested?
The test ClosedXML_Tests.XLPivotTableTests.TwoPivotWithOneSourceTest()
Thanks for the contribution. I made some additional changes to avoid having to clone elements. It's becoming clear that we'll need a big refactor of pivot tables to allow references to shared pivot sources. But for now, I think this PR is fine. Do you agree with my additional changes?