com.aspose.cells
Class SlicerCache

java.lang.Object
    extended by com.aspose.cells.SlicerCache

public class SlicerCache 
extends java.lang.Object

summary description of slicer cache

Example:

Workbook book = new Workbook();
Worksheet sheet = book.getWorksheets().get(0);
Cells cells = sheet.getCells();
cells.get(0, 0).setValue("fruit");
cells.get(1, 0).setValue("grape");
cells.get(2, 0).setValue("blueberry");
cells.get(3, 0).setValue("kiwi");
cells.get(4, 0).setValue("cherry");
cells.get(5, 0).setValue("grape");
cells.get(6, 0).setValue("blueberry");
cells.get(7, 0).setValue("kiwi");
cells.get(8, 0).setValue("cherry");
        
cells.get(0, 1).setValue("year");
cells.get(1, 1).setValue(2020);
cells.get(2, 1).setValue(2020);
cells.get(3, 1).setValue(2020);
cells.get(4, 1).setValue(2020);
cells.get(5, 1).setValue(2021);
cells.get(6, 1).setValue(2021);
cells.get(7, 1).setValue(2021);
cells.get(8, 1).setValue(2021);

cells.get(0, 2).setValue("amount");
cells.get(1, 2).setValue(50);
cells.get(2, 2).setValue(60);
cells.get(3, 2).setValue(70);
cells.get(4, 2).setValue(80);
cells.get(5, 2).setValue(90);
cells.get(6, 2).setValue(100);
cells.get(7, 2).setValue(110);
cells.get(8, 2).setValue(120);

PivotTableCollection pivots = sheet.getPivotTables();

int pivotIndex = pivots.add("=Sheet1!A1:C9", "A12", "TestPivotTable");
PivotTable pivot = pivots.get(pivotIndex);
pivot.addFieldToArea(PivotFieldType.ROW, "fruit");
pivot.addFieldToArea(PivotFieldType.COLUMN, "year");
pivot.addFieldToArea(PivotFieldType.DATA, "amount");

pivot.setPivotTableStyleType(PivotTableStyleType.PIVOT_TABLE_STYLE_MEDIUM_10);
pivot.refreshData();
pivot.calculateData();

SlicerCollection slicers = sheet.getSlicers();
int slicerIndex = slicers.add(pivot, "E12", "fruit");
Slicer slicer = slicers.get(slicerIndex);
slicer.setStyleType(SlicerStyleType.SLICER_STYLE_LIGHT_2);

//Get SlicerCache object of current slicer
SlicerCache slicerCache = slicer.getSlicerCache();

//do your business

book.save("out.xlsx");


Property Getters/Setters Summary
intgetCrossFilterType()
voidsetCrossFilterType(int)
           Returns or sets whether a slicer is participating in cross filtering with other slicers that share the same slicer cache, and how cross filtering is displayed. Read/write The value of the property is SlicerCacheCrossFilterType integer constant.
booleangetList()
           Returns whether the slicer associated with the specified slicer cache is based on an Non-OLAP data source. Read-only
java.lang.StringgetName()
           Returns the name of the slicer cache.
SlicerCacheItemCollectiongetSlicerCacheItems()
           Returns a SlicerCacheItem collection that contains the collection of all items in the slicer cache. Read-only
java.lang.StringgetSourceName()
           Returns the name of cache field
 

Property Getters/Setters Detail

getCrossFilterType/setCrossFilterType

public int getCrossFilterType() / public void setCrossFilterType(int value)
Returns or sets whether a slicer is participating in cross filtering with other slicers that share the same slicer cache, and how cross filtering is displayed. Read/write The value of the property is SlicerCacheCrossFilterType integer constant.

setCrossFilterType

public void setCrossFilterType(int value)
Returns or sets whether a slicer is participating in cross filtering with other slicers that share the same slicer cache, and how cross filtering is displayed. Read/write The value of the property is SlicerCacheCrossFilterType integer constant.

getList

public boolean getList()
Returns whether the slicer associated with the specified slicer cache is based on an Non-OLAP data source. Read-only

Example:

System.out.println(slicerCache.getList());

getSlicerCacheItems

public SlicerCacheItemCollection getSlicerCacheItems()
Returns a SlicerCacheItem collection that contains the collection of all items in the slicer cache. Read-only

Example:

//get SlicerCacheItem collection that contains the collection of all items in the slicer cache.
SlicerCacheItemCollection slicerCacheItems = slicerCache.getSlicerCacheItems();
System.out.println(slicerCacheItems.getCount());

getName

public java.lang.String getName()
Returns the name of the slicer cache.

Example:

//get the name of the slicer cache.
System.out.println(slicerCache.getName());

getSourceName

public java.lang.String getSourceName()
Returns the name of cache field

Example:

//get the name of cache field.
System.out.println(slicerCache.getSourceName());

See Also:
          Aspose.Cells Documentation - the home page for the Aspose.Cells Product Documentation.
          Aspose.Cells Support Forum - our preferred method of support.