[]
        
(Showing Draft Content)

ISlicerItem

Interface ISlicerItem


public interface ISlicerItem
Represents an item in a slicer.

An ISlicerItem corresponds to a single value in a slicer cache and exposes its display value and selection state.


 worksheet.getRange("A1:B4").setValue(new Object[][] {
     {"Category", "Amount"},
     {"Fruit", 100},
     {"Vegetable", 200},
     {"Fruit", 150}
 });
 ITable table = worksheet.getTables().add(worksheet.getRange("A1:B4"), true);
 ISlicerCache slicerCache = workbook.getSlicerCaches().add(table, "Category");
 ISlicerItem item = slicerCache.getSlicerItems().get("Fruit");
 
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Gets whether the slicer item is currently selected.
    Gets the value of the slicer item.
    void
    setSelected(boolean value)
    Sets whether the slicer item is currently selected.
  • Method Details

    • getValue

      String getValue()
      Gets the value of the slicer item.

      Use this method to retrieve the text value represented by an item in the ISlicerCache.getSlicerItems() collection.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Category", "Amount"},
           {"Fruit", 100},
           {"Drink", 200},
           {"Fruit", 150}
       });
       ITable table = worksheet.getTables().add(worksheet.getRange("A1:B4"), true);
       ISlicerCache slicerCache = workbook.getSlicerCaches().add(table, "Category", "categoryCache");
       ISlicerItem slicerItem = slicerCache.getSlicerItems().get("Fruit");
       String value = slicerItem.getValue();
       
      Returns:
      The value of the slicer item.
    • getSelected

      boolean getSelected()
      Gets whether the slicer item is currently selected.

      This property indicates whether the slicer item is included in the current slicer selection state.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Category", "Amount"},
           {"Fruit", 100},
           {"Drink", 200},
           {"Fruit", 150}
       });
       ITable table = worksheet.getTables().add(worksheet.getRange("A1:B4"), true);
       ISlicerCache slicerCache = workbook.getSlicerCaches().add(table, "Category", "categoryCache");
       ISlicerItem slicerItem = slicerCache.getSlicerItems().get("Fruit");
       boolean selected = slicerItem.getSelected();
       
      Returns:
      true if the slicer item is selected; otherwise, false.
    • setSelected

      void setSelected(boolean value)
      Sets whether the slicer item is currently selected.

      This property indicates whether the slicer item is included in the current slicer selection state.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Category", "Amount"},
           {"Fruit", 100},
           {"Drink", 200},
           {"Fruit", 150}
       });
       ITable table = worksheet.getTables().add(worksheet.getRange("A1:B4"), true);
       ISlicerCache slicerCache = workbook.getSlicerCaches().add(table, "Category", "categoryCache");
       ISlicerItem slicerItem = slicerCache.getSlicerItems().get("Fruit");
       slicerItem.setSelected(true);
       
      Parameters:
      value - true if the slicer item is selected; otherwise, false.