Read Pivot Filter Data


#1

Hello,

I have requirement to display the Pivot filter values on GUI. Please find the attached images which for the reference.

  • I have Pivot table which contains the values LOB, Audited_By and Download_Status.
  • When we click on the “Audited_By” filter we get different values. My requirement is that can we read these dropdown values and display it on GUI using Aspose?

Also attached the Excel file which contains Pivot tables in Sheet1

Efficiency Test Data.zip (27.2 KB)

Regards,
Vinay VFilter1.PNG (12.0 KB)
Filter2.PNG (16.6 KB)


#2

@vvibhuti,

Thanks for the template file, screenshots and details.

I am unable to retrieve page fields’ items in the Pivottable report. I used the following sample code using your template file to try to accomplish the task but in vain:
e.g
Sample code:

Workbook wb_demo = new Workbook("f:\\files\\Efficiency Test Data.xlsx"); 
        PivotTable pt_demo = wb_demo.getWorksheets().get(1).getPivotTables().get(0); 
                
        pt_demo.getPageFields().get(1).setShowAllItems(true); 
        //Get the second Pivot page field 
        PivotField src_t_field = pt_demo.getPageFields().get(1); 
        src_t_field.setMultipleItemSelectionAllowed(true); 
         
        System.out.println(src_t_field.getName());//Audited_By - Ok 
        System.out.println("Total Items: " + src_t_field.getItems().length);//0 - Not Ok 
        System.out.println("Total Items: " + src_t_field.getPivotItems().getCount());//0 - Not Ok 
         
        //pt_demo.refreshData(); 
        
        //This code segment is for no use 
        PivotItemCollection collection_src_t = src_t_field.getPivotItems(); 
        for (int i = 0; i < collection_src_t.getCount(); i++) 
        { 
              PivotItem item = collection_src_t.get(i); 
              System.out.println(item.getName()); 
                             
        }  

We need to look into it thoroughly if the code needs some tweak to accomplish the task, we will do that soon. I have logged a ticket with an id “CELLSJAVA-42750” for your issue.

Once we figure it out, we will let you know.