Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

New Post: Issue with Pivot Tables

$
0
0
I finally had a chance to dive into this (I wrote the example this is derived from); it looks like the problem is that ClosedXML doesn't update the location of the pivot table when you add a report filter. The filter gets added at cell A1 on the PivotTable sheet, but the pt object is still tracking its location as starting at A1.

If you change the line
var pt = ptSheet.PivotTables.AddNew("PivotTable", ptSheet.Cell(1, 1), dataRange);

to

var pt = ptSheet.PivotTables.AddNew("PivotTable", ptSheet.Cell(3, 1), dataRange);

your example will work correctly. Unfortunately, I don't see an easy way to modify the ClosedXML code to adjust the pivot table's location automatically when the report filter is added. Perhaps someone more involved with the project would know how to address this. You might want to open an issue.

Viewing all articles
Browse latest Browse all 1877

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>