Workbook wb = new Workbook(@"../../APP_DATA/UnsortedSamleData1.xlsb"); Worksheet ws = wb.Worksheets; var pTable = ws.PivotTables; pTable.RefreshDataFlag = true; pTable.RowFields.IsAutoSort = true; pTable.RowFields.IsAscendSort = false; pTable.RowFields.AutoSortField = 43; //pTable.RefreshDataOnOpeningFile = true; pTable.RefreshData(); pTable.CalculateData(); //Need ptable to be sorted by here. We will be using the sorted index for grouprows for accounts with empty amounts in the next code. //Currently ptable is not sorted and is messing up with groupsrows wb.Save(@"../../APP_DATA/Output.Xlsb", SaveFormat.Xlsb); //it sorts fine once the excel is opened means RefreshDataOnOpeningFile is working fine.
Thanks for your query.
Please provide your sample file along with the detailed description of issue with the help of images/snapshots. We will reproduce the problem and provide our feedback after analysis.
Thanks for the response. I am uploading the sample file and my findings.RefreshSortinghappensOnlAafterOpeningfile.zip (489.5 KB)
We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.
This issue has been logged as
CELLSNET-46484 - RefreshData doesn’t sort data before opening file in Excel