Free Support Forum - aspose.com

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.


#3

@vvibhuti,

This is to inform you that we have fixed your issue (logged earlier as “CELLSJAVA-42750”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.


#4

@vvibhuti,

Please try our latest version/fix: Aspose.Cells for Java v18.12.3 (attached)

Your issue should be fixed in it.
Please note:

  1. Please call the method named “refreshData” before getting details. The sample code in Java is as follows:
    e.g
    Sample code:

         Workbook wb_demo = new Workbook(filePath + "Efficiency Test Data.xlsx"); 
         PivotTable pt_demo = wb_demo.getWorksheets().get(1).getPivotTables().get(0); 
                 
         // add this line to refresh data
         pt_demo.refreshData();
         
         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 
         
         //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()); 
                              
         }  
    

Let us know your feedback.
Aspose.Cells for Java_v18.12.3.zip (6.4 MB)


#5

The issues you have found earlier (filed as CELLSJAVA-42750) have been fixed in Aspose.Cells for Java 19.1. You can also get the latest Aspose.Cells for Java version from Maven repos. with simple configurations. Please see the document for your reference: https://docs.aspose.com/display/cellsjava/Installation

This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi