[]
An ISlicerCache is created from a table or pivot table field and provides access to the slicers and slicer items that use that cache.
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");
voidvoiddelete()ISlicer objects associated with it.booleanbooleangetList()getName()ISlicerPivotTables collection that contains the PivotTable objects currently filtered by the slicer cache.ISlicerItems collection that contains all items in the slicer cache.ISlicers collection associated with this ISlicerCache.getTable()voidvoidsetSortItems(SlicerSortOrder value) Returns true when no slicer items in the cache are excluded by filtering. This value becomes true after calling clearAllFilters().
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"Category", "Amount"},
{"Fruit", 100},
{"Vegetables", 200},
{"Fruit", 150}
});
ITable table = worksheet.getTables().add(worksheet.getRange("A1:B4"), true);
ISlicerCache slicerCache = workbook.getSlicerCaches().add(table, "Category", "categoryCache");
boolean filterCleared = slicerCache.getFilterCleared();
true if the slicer cache filter state is cleared; otherwise, false.This method returns true when the slicer cache was created from a table data source, and false when it was created from another supported data source such as a PivotTable.
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");
boolean isTableSlicerCache = slicerCache.getList();
true if the slicer cache is for a slicer on a table; otherwise, false.Use this method to access the ITable that supplies the data source for the slicer cache.
Object[][] sourceData = new Object[][] {{"Category"}, {"Fruit"}, {"Vegetables"}};
worksheet.getRange("A1:A3").setValue(sourceData);
ITable table = worksheet.getTables().add(worksheet.getRange("A1:A3"), true);
ISlicerCache slicerCache = workbook.getSlicerCaches().add(table, "Category", "categoryCache");
ITable slicerTable = slicerCache.getTable();
ITable object associated with the slicer cache.This value is the name used to reference the slicer cache. It can be specified when the cache is created by ISlicerCaches.add(Object,String,String) or changed later by setName(String).
Object[][] sourceData = new Object[][] {{"Category"}, {"Fruit"}, {"Vegetables"}};
worksheet.getRange("A1:A3").setValue(sourceData);
ITable table = worksheet.getTables().add(worksheet.getRange("A1:A3"), true);
ISlicerCache slicerCache = workbook.getSlicerCaches().add(table, "Category", "categoryCache");
String name = slicerCache.getName();
Object[][] sourceData = new Object[][] {{"Category"}, {"Fruit"}, {"Vegetables"}};
worksheet.getRange("A1:A3").setValue(sourceData);
ITable table = worksheet.getTables().add(worksheet.getRange("A1:A3"), true);
ISlicerCache slicerCache = workbook.getSlicerCaches().add(table, "Category", "categoryCache");
slicerCache.setName("categoryCacheRenamed");
value - The name of the slicer cache.This value identifies the field in the underlying table or PivotTable data source that the slicer cache uses for filtering.
Object[][] sourceData = new Object[][] {{"Category"}, {"Fruit"}, {"Vegetables"}};
worksheet.getRange("A1:A3").setValue(sourceData);
ITable table = worksheet.getTables().add(worksheet.getRange("A1:A3"), true);
ISlicerCache slicerCache = workbook.getSlicerCaches().add(table, "Category", "categoryCache");
String sourceName = slicerCache.getSourceName();
ISlicerPivotTables collection that contains the PivotTable objects currently filtered by the slicer cache. Use this method to access the PivotTable objects associated with the current slicer cache.
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"Category", "Amount"},
{"Beverages", 100},
{"Produce", 200},
{"Beverages", 150}
});
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B4"));
IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"), "SalesPivot");
ISlicerCache slicerCache = workbook.getSlicerCaches().add(pivotTable, "Category");
ISlicerPivotTables pivotTables = slicerCache.getPivotTables();
ISlicerPivotTables collection that contains the PivotTable objects currently filtered by the slicer cache.ISlicerItems collection that contains all items in the slicer cache.Use this method to access the cached items for the slicer's source field, including items that can be retrieved by index or by item name.
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");
ISlicerItems slicerItems = slicerCache.getSlicerItems();
ISlicerItem slicerItem = slicerItems.get("Fruit");
ISlicerItems collection that contains all items in the slicer cache.ISlicers collection associated with this ISlicerCache. The returned collection contains the ISlicer objects that use this slicer cache.
Object[][] sourceData = new Object[][] {{"Category"}, {"Fruit"}, {"Vegetables"}};
worksheet.getRange("A1:A3").setValue(sourceData);
ITable table = worksheet.getTables().add(worksheet.getRange("A1:A3"), true);
ISlicerCache slicerCache = workbook.getSlicerCaches().add(table, "Category", "categoryCache");
ISlicers slicers = slicerCache.getSlicers();
slicers.add(worksheet, "categorySlicer", "Category", 20, 20, 120, 160);
ISlicers collection that contains the ISlicer objects associated with this ISlicerCache.Use this method to retrieve whether slicer items are currently sorted in ascending or descending order.
Object[][] sourceData = new Object[][] {{"Category"}, {"Fruit"}, {"Vegetables"}};
worksheet.getRange("A1:A3").setValue(sourceData);
ITable table = worksheet.getTables().add(worksheet.getRange("A1:A3"), true);
ISlicerCache slicerCache = workbook.getSlicerCaches().add(table, "Category", "categoryCache");
slicerCache.setSortItems(SlicerSortOrder.Descending);
SlicerSortOrder sortOrder = slicerCache.getSortItems();
Use this method to control whether slicer items are displayed in ascending or descending order.
Object[][] sourceData = new Object[][] {{"Category"}, {"Fruit"}, {"Vegetables"}};
worksheet.getRange("A1:A3").setValue(sourceData);
ITable table = worksheet.getTables().add(worksheet.getRange("A1:A3"), true);
ISlicerCache slicerCache = workbook.getSlicerCaches().add(table, "Category", "categoryCache");
slicerCache.setSortItems(SlicerSortOrder.Descending);
value - The sort order of the items in the slicer.This method removes the current slicer filter state and restores the display of all items according to the slicer cache type.
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"Category", "Amount"},
{"Fruit", 100},
{"Vegetables", 200},
{"Fruit", 150}
});
ITable table = worksheet.getTables().add(worksheet.getRange("A1:B4"), true);
ISlicerCache cache = workbook.getSlicerCaches().add(table, "Category", "categoryCache");
cache.getSlicerItems().get("Vegetables").setSelected(false);
cache.clearAllFilters();
ISlicer objects associated with it.After this method is called, the slicer cache is removed from the workbook's slicer cache collection.
worksheet.getRange("A1:B4").setValue(new Object[][] {
{"Category", "Amount"},
{"Beverages", 100},
{"Produce", 200},
{"Snacks", 150}
});
ITable table = worksheet.getTables().add(worksheet.getRange("A1:B4"), true);
ISlicerCache cache = workbook.getSlicerCaches().add(table, "Category");
cache.getSlicers().add(worksheet, "categorySlicer", "Category", 30, 100, 120, 160);
cache.delete();