Slicer for PivotTable

Is it possible to create and manipulate a Slicer using Aspose Cells? I cannot find it in the documentation and there are a number of forum threads asking for this feature that are over two years old. They were given ticket references CELLSNET-42793 and CELLSNET-44455. How can I check the status of these tickets?

If it is not possible currently then is it on the roadmap for the future?

Thanks
Steve

@SteveHawes,

I am afraid, the feature (“CELLSNET-44455” - Create or Update Slicer in Excel 2013 using Aspose.Cells) is not yet supported. I have attached the ticket to your thread as well, so once the feature is supported, you could be notified. Regarding ETA, I am afraid, it is not available yet. It looks like it is not in roadmap, so it might not be supported in near future.

Once we have some progress on it, we will update you.

@SteveHawes

Thanks for using Aspose APIs.

It is to inform you that we will support this feature for Xlsx and Xlsm format in the second quarter of 2018.

Once, we will have some fix or more news for you, we will update you asap.

That’s great news thanks (and I suspect it will make a lot of people very happy!) :grin:

Thanks
Steve

@SteveHawes

You are right. :slight_smile:

@SteveHawes,

This is to inform you that we have fixed your issue (logged earlier as “CELLSNET-44455”). We will soon provide you the fix after performing QA and incorporating other enhancements and fixes.


We will provide the release version later. The sample code will be as follows

C#

Workbook wb = new Workbook(filePath + "a.xlsx"); 
Worksheet sheet = wb.Worksheets[0]; 

//create slicer 
PivotTable pivot = sheet.PivotTables[0]; 
int index = sheet.Slicers.Add(pivot, "A10", pivot.BaseFields[0]); 
Slicer slicer = sheet.Slicers[index]; 
slicer.NumberOfColumns = 2; 
slicer.StyleType = SlicerStyleType.SlicerStyleDark1; 


wb.Save(filePath + "a_createSlicer.xlsx"); 
wb.Save(filePath + "a_createSlicer.xlsb"); 

//update slicer 
SlicerCacheItemCollection items = slicer.SlicerCache.SlicerCacheItems; 
int itemCount = items.Count; 
for (int i = 0; i < itemCount;i++) 
{ 
    SlicerCacheItem item = items[i]; 
    //only select partial items 
    if (i % 2 == 0) 
    { 
        item.Selected = false; 
    } 
} 
slicer.Refresh(); 

wb.Save(filePath + "a_updateSlicer.xlsx"); 
wb.Save(filePath + "a_updateSlicer.xlsb"); 

//remove slicer 
sheet.Slicers.Remove(slicer); 
wb.Save(filePath + "a_removeSlicer.xlsx"); 
wb.Save(filePath + "a_removeSlicer.xlsb");

file1.zip (9.0 KB)

The issues you have found earlier (filed as CELLSNET-44455) have been fixed in Aspose.Cells for .NET 18.6. Please also check the document/article for your reference: Install Aspose Cells through NuGet|Documentation