Excel 2003 and Excel 2007 have different algorithms for ‘Top 10…’ Filter. For documents with the old filter all work properly, but for the new filter type: ‘IsAutoShow’ and ‘AutoShowField’ are incorrect. These properties always have the same value: IsAutoShow = false, AutoShowField = -1.
I created simple document with pivot table in Excel 2003 (testAutoShow2003.xls). It has ‘Top 10…’ filter for ‘Product’ field.
IsAutoShow = true
AutoShowField = 0
I converted this document to *.xlsx format and refreshed the pivot table (testAutoShow2003To2010Refresh.xlsx). Excel asked me about changes in filtering and I agreed. The values of properties are incorrect now.
IsAutoShow = false
AutoShowField = -1
I also tried to refresh *.xls file in Excel 2010 (testAutoShow2003Refresh.xls) and convert to *.xlsx without refreshing (testAutoShow2003To2010.xlsx), but new documents have no such problems. So the problem may be related with the new filtering algorithm.
PivotFieldCollection pfc = pt.RowFields;Thanks,
for (int i = 0; i < pfc.Count; i++)
PivotField pf = pfc[i];
printLine(“AutoShowField”, pf.AutoShowField.ToString(), SPACE4); // my inner printing method
printLine(“IsAutoShow”, pf.IsAutoShow.ToString(), SPACE4);