[]
        
(Showing Draft Content)

ISlicerPivotTables

Interface ISlicerPivotTables

All Superinterfaces:
Iterable<IPivotTable>

public interface ISlicerPivotTables extends Iterable<IPivotTable>
Represents the collection of IPivotTable objects associated with a specified ISlicerCache.

Use this collection to inspect, add, or remove PivotTable references controlled by the slicer cache.


 IRange source = worksheet.getRange("A1:B3");
 source.setValue(new Object[][] {
     {"Product", "Amount"},
     {"A", 10},
     {"B", 20}
 });
 IPivotCache pivotCache = workbook.getPivotCaches().create(source);
 IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"), "PivotTable1");
 ISlicerCache cache = workbook.getSlicerCaches().add(pivotTable, "Product");
 ISlicerPivotTables pivotTables = cache.getPivotTables();
 int count = pivotTables.getCount();
 
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds the specified PivotTable to the association list for the slicer cache.
    get(int index)
    Gets the PivotTable reference at the specified index in the slicer cache.
    int
    Gets the number of PivotTable references associated with the slicer cache.
    void
    Removes the specified PivotTable from the slicer cache association list.

    Methods inherited from interface java.lang.Iterable

    forEach, iterator, spliterator
  • Method Details

    • get

      IPivotTable get(int index)
      Gets the PivotTable reference at the specified index in the slicer cache. The index is zero-based.
      
       worksheet.getRange("A1:B3").setValue(new Object[][] {{"Product", "Amount"}, {"A", 10}, {"B", 20}});
       IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B3"));
       IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"), "PivotTable1");
       ISlicerCache cache = workbook.getSlicerCaches().add(pivotTable, "Product");
       IPivotTable firstPivotTable = cache.getPivotTables().get(0);
       
      Parameters:
      index - The index of the PivotTable reference in the slicer cache, starting at 0.
      Returns:
      The PivotTable reference at the specified index in the slicer cache.
    • getCount

      int getCount()
      Gets the number of PivotTable references associated with the slicer cache.
      
       worksheet.getRange("A1:B3").setValue(new Object[][] {{"Product", "Amount"}, {"A", 10}, {"B", 20}});
       IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B3"));
       IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"), "PivotTable1");
       ISlicerCache cache = workbook.getSlicerCaches().add(pivotTable, "Product");
       int count = cache.getPivotTables().getCount();
       
      Returns:
      The PivotTable reference count associated with the slicer cache.
    • addPivotTable

      void addPivotTable(IPivotTable pivotTable)
      Adds the specified PivotTable to the association list for the slicer cache.
      
       worksheet.getRange("A1:B3").setValue(new Object[][] {{"Product", "Amount"}, {"A", 10}, {"B", 20}});
       IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B3"));
       IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"), "PivotTable1");
       ISlicerCache cache = workbook.getSlicerCaches().add(pivotTable, "Product");
       IPivotTable anotherPivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("H1"), "PivotTable2");
       cache.getPivotTables().addPivotTable(anotherPivotTable);
       
      Parameters:
      pivotTable - The PivotTable to add to the association list for the slicer cache.
    • removePivotTable

      void removePivotTable(IPivotTable pivotTable)
      Removes the specified PivotTable from the slicer cache association list.
      
       worksheet.getRange("A1:B3").setValue(new Object[][] {{"Product", "Amount"}, {"A", 10}, {"B", 20}});
       IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B3"));
       IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"), "PivotTable1");
       ISlicerCache cache = workbook.getSlicerCaches().add(pivotTable, "Product");
       cache.getPivotTables().removePivotTable(pivotTable);
       
      Parameters:
      pivotTable - The specified PivotTable to remove from the slicer cache association list.