Document Solutions for Excel, Java Edition | Document Solutions
Features / Slicer / Slicer Style
In This Topic
    Slicer Style
    In This Topic

    DsExcel Java enables uers to apply style to the slicers. While adding a slicer, users first need to create a slicer cache and then use the slicer cache created base on the column of the table or the pivot table.

    The ISlicerCaches interface in DsExcel Java holds all the slicer caches in the workbook.

    Set slicer to built-in style

    You can set a slicer to built-in style by using the setStyle method of the ISlicer interface.

    In order to set slicer to built-in style, refer to the following example code.

    Java
    Copy Code
    // Create slicer cache for table.
    ISlicerCache cache = workbook.getSlicerCaches().add(table, "Category", "categoryCache");
    
    // Add slicer
    ISlicer slicer = cache.getSlicers().add(workbook.getWorksheets().get("Sheet1"), "cate1", 
    "Category", 30, 550, 100, 200);
    
    // Set slicer style to built-in style.
    slicer.setStyle(workbook.getTableStyles().get("SlicerStyleLight2"));