## Slicer class


summary description of [Slicer](./) View

```cpp
class Slicer
```

## Methods

| Method | Description |
| --- | --- |
| [AddPivotConnection(const PivotTable\& pivot)](./addpivotconnection/) | Adds PivotTable connection. |
| [ClearFilter()](./clearfilter/) | Remove filters. |
| [GetAlternativeText()](./getalternativetext/) |  **(Deprecated)** Returns or sets the descriptive (alternative) text string of the [Slicer](./) object. |
| [GetCaption()](./getcaption/) | Returns or sets the caption of the specified slicer. |
| [GetCaptionVisible()](./getcaptionvisible/) |  **(Deprecated)** Returns or sets whether the header that displays the slicer Caption is visible. The default value is true. |
| [GetColumnWidth()](./getcolumnwidth/) | Returns or sets the width of each column in the slicer in unit of points. |
| [GetColumnWidthPixel()](./getcolumnwidthpixel/) | Gets or sets the width of each column in the slicer, in unit of pixels. |
| [GetFirstItemIndex()](./getfirstitemindex/) | Specifies the zero-based index of the first slicer item. |
| [GetHeight()](./getheight/) |  **(Deprecated)** Returns or sets the height of the specified slicer, in points. |
| [GetHeightPixel()](./getheightpixel/) |  **(Deprecated)** Returns or sets the height of the specified slicer, in pixels. |
| [GetLeftPixel()](./getleftpixel/) |  **(Deprecated)** Returns or sets the horizontal offset of slicer shape from its left column, in pixels. |
| [GetLockedAspectRatio()](./getlockedaspectratio/) |  **(Deprecated)** Indicates whether locking aspect ratio. |
| [GetLockedPosition()](./getlockedposition/) | Indicates whether the specified slicer can be moved or resized by using the user interface. |
| [GetName()](./getname/) | Returns or sets the name of the specified slicer. |
| [GetNumberOfColumns()](./getnumberofcolumns/) | Returns or sets the number of columns in the slicer. The default value is 1. |
| [GetParent()](./getparent/) |  **(Deprecated)** Returns the [Worksheet](../../aspose.cells/worksheet/) object which contains this slicer. Read-only. |
| [GetPlacement()](./getplacement/) |  **(Deprecated)** Represents the way the drawing object is attached to the cells below it. The property controls the placement of an object on a worksheet. |
| [GetRowHeight()](./getrowheight/) | Returns or sets the height of each row in the specified slicer in unit of points. |
| [GetRowHeightPixel()](./getrowheightpixel/) | Returns or sets the height of each row in the specified slicer, in unit of pixels. |
| [GetShape()](./getshape/) | Returns the Shape object associated with the specified slicer. Read-only. |
| [GetShowAllItems()](./getshowallitems/) | Indicates whether to show all items even if there are no data or they are deleted. Default value is true;. |
| [GetShowCaption()](./getshowcaption/) | Indicates whether the header of the slicer is visible. The default value is true. |
| [GetShowMissing()](./getshowmissing/) | Indicates whether to show items deteleted from the data source. |
| [GetShowTypeOfItemsWithNoData()](./getshowtypeofitemswithnodata/) | Indicates whether to show items deteleted from the data source. |
| [GetSlicerCache()](./getslicercache/) | Returns the [SlicerCache](../slicercache/) object associated with the slicer. Read-only. |
| [GetSortOrderType()](./getsortordertype/) | Indicates the type of sorting items. |
| [GetStyleType()](./getstyletype/) | Specify the type of Built-in slicer style. The default type is SlicerStyleLight1. |
| [GetTitle()](./gettitle/) |  **(Deprecated)** Specifies the title of the current [Slicer](./) object. |
| [GetTopPixel()](./gettoppixel/) |  **(Deprecated)** Returns or sets the vertical offset of slicer shape from its top row, in pixels. |
| [GetWidth()](./getwidth/) |  **(Deprecated)** Returns or sets the width of the specified slicer, in points. |
| [GetWidthPixel()](./getwidthpixel/) |  **(Deprecated)** Returns or sets the width of the specified slicer, in pixels. |
| [GetWorksheet()](./getworksheet/) | Returns the [Worksheet](../../aspose.cells/worksheet/) object which contains this slicer. Read-only. |
| [IsLocked()](./islocked/) |  **(Deprecated)** Indicates whether the slicer shape is locked. |
| [IsNull()](./isnull/) const | Checks whether the implementation object is nullptr. |
| [IsPrintable()](./isprintable/) |  **(Deprecated)** Indicates whether the slicer object is printable. |
| explicit [operator bool()](./operator_bool/) const | operator bool() |
| [operator=(const Slicer\& src)](./operator_asm/) | operator= |
| [Refresh()](./refresh/) | Refreshing the items of the slicer from the associated pivot tables. |
| [RemovePivotConnection(const PivotTable\& pivot)](./removepivotconnection/) | Removes PivotTable connection. |
| [SelectItems(const Vector \<U16String\>\& labels, bool append)](./selectitems/) |  |
| [SetAlternativeText(const U16String\& value)](./setalternativetext/) |  **(Deprecated)** Returns or sets the descriptive (alternative) text string of the [Slicer](./) object. |
| [SetAlternativeText(const char16_t* value)](./setalternativetext/) |  **(Deprecated)** Returns or sets the descriptive (alternative) text string of the [Slicer](./) object. |
| [SetCaption(const U16String\& value)](./setcaption/) | Returns or sets the caption of the specified slicer. |
| [SetCaption(const char16_t* value)](./setcaption/) | Returns or sets the caption of the specified slicer. |
| [SetCaptionVisible(bool value)](./setcaptionvisible/) |  **(Deprecated)** Returns or sets whether the header that displays the slicer Caption is visible. The default value is true. |
| [SetColumnWidth(double value)](./setcolumnwidth/) | Returns or sets the width of each column in the slicer in unit of points. |
| [SetColumnWidthPixel(int32_t value)](./setcolumnwidthpixel/) | Gets or sets the width of each column in the slicer, in unit of pixels. |
| [SetFirstItemIndex(int32_t value)](./setfirstitemindex/) | Specifies the zero-based index of the first slicer item. |
| [SetHeight(double value)](./setheight/) |  **(Deprecated)** Returns or sets the height of the specified slicer, in points. |
| [SetHeightPixel(int32_t value)](./setheightpixel/) |  **(Deprecated)** Returns or sets the height of the specified slicer, in pixels. |
| [SetIsLocked(bool value)](./setislocked/) |  **(Deprecated)** Indicates whether the slicer shape is locked. |
| [SetIsPrintable(bool value)](./setisprintable/) |  **(Deprecated)** Indicates whether the slicer object is printable. |
| [SetLeftPixel(int32_t value)](./setleftpixel/) |  **(Deprecated)** Returns or sets the horizontal offset of slicer shape from its left column, in pixels. |
| [SetLockedAspectRatio(bool value)](./setlockedaspectratio/) |  **(Deprecated)** Indicates whether locking aspect ratio. |
| [SetLockedPosition(bool value)](./setlockedposition/) | Indicates whether the specified slicer can be moved or resized by using the user interface. |
| [SetName(const U16String\& value)](./setname/) | Returns or sets the name of the specified slicer. |
| [SetName(const char16_t* value)](./setname/) | Returns or sets the name of the specified slicer. |
| [SetNumberOfColumns(int32_t value)](./setnumberofcolumns/) | Returns or sets the number of columns in the slicer. The default value is 1. |
| [SetPlacement(PlacementType value)](./setplacement/) |  **(Deprecated)** Represents the way the drawing object is attached to the cells below it. The property controls the placement of an object on a worksheet. |
| [SetRowHeight(double value)](./setrowheight/) | Returns or sets the height of each row in the specified slicer in unit of points. |
| [SetRowHeightPixel(int32_t value)](./setrowheightpixel/) | Returns or sets the height of each row in the specified slicer, in unit of pixels. |
| [SetShowAllItems(bool value)](./setshowallitems/) | Indicates whether to show all items even if there are no data or they are deleted. Default value is true;. |
| [SetShowCaption(bool value)](./setshowcaption/) | Indicates whether the header of the slicer is visible. The default value is true. |
| [SetShowMissing(bool value)](./setshowmissing/) | Indicates whether to show items deteleted from the data source. |
| [SetShowTypeOfItemsWithNoData(ItemsWithNoDataShowMode value)](./setshowtypeofitemswithnodata/) | Indicates whether to show items deteleted from the data source. |
| [SetSortOrderType(SortOrder value)](./setsortordertype/) | Indicates the type of sorting items. |
| [SetStyleType(SlicerStyleType value)](./setstyletype/) | Specify the type of Built-in slicer style. The default type is SlicerStyleLight1. |
| [SetTitle(const U16String\& value)](./settitle/) |  **(Deprecated)** Specifies the title of the current [Slicer](./) object. |
| [SetTitle(const char16_t* value)](./settitle/) |  **(Deprecated)** Specifies the title of the current [Slicer](./) object. |
| [SetTopPixel(int32_t value)](./settoppixel/) |  **(Deprecated)** Returns or sets the vertical offset of slicer shape from its top row, in pixels. |
| [SetWidth(double value)](./setwidth/) |  **(Deprecated)** Returns or sets the width of the specified slicer, in points. |
| [SetWidthPixel(int32_t value)](./setwidthpixel/) |  **(Deprecated)** Returns or sets the width of the specified slicer, in pixels. |
| [Slicer(Slicer_Impl* impl)](./slicer/) | Constructs from an implementation object. |
| [Slicer(const Slicer\& src)](./slicer/) | Copy constructor. |
| [UnselectItems(const Vector \<U16String\>\& labels)](./unselectitems/) | Remove selected filter labels. |
| [~Slicer()](./~slicer/) | Destructor. |
## Fields

| Field | Description |
| --- | --- |
| [_impl](./_impl/) | The implementation object. |

## Examples


```cpp
Aspose::Cells::Startup();
Workbook book;
Worksheet sheet = book.GetWorksheets().Get(0);
Cells cells = sheet.GetCells();
cells.Get(0, 0).PutValue(u"fruit");
cells.Get(1, 0).PutValue(u"grape");
cells.Get(2, 0).PutValue(u"blueberry");
cells.Get(3, 0).PutValue(u"kiwi");
cells.Get(4, 0).PutValue(u"cherry");
cells.Get(5, 0).PutValue(u"grape");
cells.Get(6, 0).PutValue(u"blueberry");
cells.Get(7, 0).PutValue(u"kiwi");
cells.Get(8, 0).PutValue(u"cherry");

cells.Get(0, 1).PutValue(u"year");
cells.Get(1, 1).PutValue(2020);
cells.Get(2, 1).PutValue(2020);
cells.Get(3, 1).PutValue(2020);
cells.Get(4, 1).PutValue(2020);
cells.Get(5, 1).PutValue(2021);
cells.Get(6, 1).PutValue(2021);
cells.Get(7, 1).PutValue(2021);
cells.Get(8, 1).PutValue(2021);

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

PivotTableCollection pivots = sheet.GetPivotTables();

int pivotIndex = pivots.Add(u"=Sheet1!A1:C9", u"A12", u"TestPivotTable");
PivotTable pivot = pivots.Get(pivotIndex);
pivot.AddFieldToArea(PivotFieldType::Row, u"fruit");
pivot.AddFieldToArea(PivotFieldType::Column, u"year");
pivot.AddFieldToArea(PivotFieldType::Data, u"amount");

pivot.SetPivotTableStyleType(PivotTableStyleType::PivotTableStyleMedium10);
pivot.RefreshData();
pivot.CalculateData();

SlicerCollection slicers = sheet.GetSlicers();
int slicerIndex = slicers.Add(pivot, u"E12", u"fruit");
Slicer slicer = slicers.Get(slicerIndex);
slicer.SetStyleType(SlicerStyleType::SlicerStyleLight2);

SlicerCacheItemCollection items = slicer.GetSlicerCache().GetSlicerCacheItems();
SlicerCacheItem item = items.Get(0);
item.SetSelected(false);
book.Save("out.xlsx");
Aspose::Cells::Cleanup();
```

## See Also

* Namespace [Aspose::Cells::Slicers](../)
* Library [Aspose.Cells for C++](../../)
