I'm trying to create an Excel pivot table entirely from scratch, using OpenXml.
I've successfully created the pivot table itself (created a PivotTable definition, a cache definition, all the cache records, pivotFields, RowItems, etc. etc.).
But how do I display any of the data? How do I read the PivotTable calculations in order to write these values to cells?
For example:
- The "grand total" is $86,631.62.
- Two subtotals are $61,631,12 and $25,000.50
When I look at the XML in xl\worksheets\sheet2.xml
, these values are all "hard coded" into the cell.
If I'm creating the cell myself (using OpenXml), then how do I "query" these values, letting the Pivot Table calculate them for me?
PS: I've been using the OpenXml Productivity Tool extensively ... but it, too, just "hard codes" the totals and subtotals ... without giving any clue how/where the values were actually calculated.