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

Closed Unassigned: Index of RowLabel and ColumnLabel in PivotTable [9326]

$
0
0
File XLWorkbook_Save.cs
Line 2222
Creation of RowLabels
```
var f = new Field {Index = pt.Fields.IndexOf(xlpf)};
```
Line 2240
```
var f = new Field {Index = pt.Fields.IndexOf(xlpf)};
```
The index of RowLabels and ColumnLabels is not correct because it is based on the order of Fields Collection

Is it correct changing the code in this way?
```
var f = new Field {Index = pt.RowLabels.IndexOf(pt.RowLabels.FirstOrDefault(p => p.SourceName == xlpf.SourceName))};
```
```
var f = new Field { Index = pt.ColumnLabels.IndexOf(pt.ColumnLabels.FirstOrDefault(p => p.SourceName == xlpf.SourceName)) };
```
Comments: Thanks. Pick up the latest source code.

Viewing all articles
Browse latest Browse all 1877

Trending Articles



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