Challenge while creating a Slicer from a Pivot Table using Aspose Cells JAVA

Greetings Team,

I have a table of data from which I am creating a Pivot Table and then I need to create a Slicer, but through code I am unable to create a Slicer. The code is not throwing any error but also the Slicer is not working.

I have attached the Input File: Slicer.xlsx and Output File: Slicer Output.xlsx

public class Slicer {

    public static void main(String[] args) throws Exception {
        Workbook book = new Workbook("Slicer.xlsx");
        Worksheet sheet = book.getWorksheets().get(0);
        PivotTableCollection pivots = sheet.getPivotTables();

        int pivotIndex = pivots.add("=A1:D8", "A12", "TestPivotTable");
        PivotTable pivot = pivots.get(pivotIndex);
        pivot.addFieldToArea(PivotFieldType.ROW, "Fruit");
        pivot.addFieldToArea(PivotFieldType.COLUMN, "Customer");
        pivot.addFieldToArea(PivotFieldType.DATA, "Quantity");

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

        SlicerCollection slicers = sheet.getSlicers();
        int slicerIndex = slicers.add(pivot, "A30", "Fruit");
        com.aspose.cells.Slicer slicer = slicers.get(slicerIndex);
        slicer.setStyleType(SlicerStyleType.SLICER_STYLE_LIGHT_2);

        SlicerCacheItemCollection items = slicer.getSlicerCache().getSlicerCacheItems();
        SlicerCacheItem item = items.get(0);
        item.setSelected(false);
        //do your business
        book.save("Slicer Output.xlsx");

    }

}

Kindly please help in creating a Slicer.

Thanks in advance.

@sudiprana,
It seems that you forgot to add the attachment.
Please compress files into zip and upload them again. We will check the files soon.
Thank you !

Slicer.zip (16.4 KB)
Greetings @John.He
Apologies. I have attached the files now.

@sudiprana,
By using the latest version of Aspose.Cells for Java 23.8 for testing, we can obtain the correct results. Please refer to the attachment (12.8 KB).
Would you like to retest it using the latest version? If you still encounter issues, please share some environmental information such as JDK version, operating system, etc.

Greetings @John.He
Sure let me check it with the latest version.
The version I was using was 19.12. I think the feature might be missing there.

@sudiprana,
Thank you for your feedback. Our product has been constantly updating and iterating, and its functions are gradually enhancing. The latest version can meet more application scenarios. If you have any questions, please feel free to contact us.

Greetings @John.He
I am unable to generate even using the 23.8 version.
Can you please share your code snippet and can you please confirm once with 19.12 version.

Thanks in advance.

@sudiprana,
The test code I used is the sample code you provided. I haven’t made any changes. In 23.8 version, i can get the correct results. Slicer cannot work in 19.12 version.
Please output your version number using the following code to ensure that you are using the latest version for testing.

System.out.println(CellsHelper.getVersion());

If you still encounter issues, please compress the files you generated using the latest version and upload them here.

Thanks @John.He for all the info.
Sure let me dig a bit probably the issue should get resolved.

@sudiprana,
Thank you for your feedback. If you have any questions, please feel free to contact us.