Aspose::Cells::Slicers::Slicer class
Contents
[
Hide
]Slicer class
summary description of Slicer View
class Slicer
Methods
Method | Description |
---|---|
AddPivotConnection(const PivotTable& pivot) | Adds PivotTable connection. |
GetAlternativeText() | Returns or sets the descriptive (alternative) text string of the Slicer object. |
GetCaption() | Returns or sets the caption of the specified slicer. |
GetCaptionVisible() | Returns or sets whether the header that displays the slicer Caption is visible the default value is true. |
GetColumnWidth() | Returns or sets the width, in points, of each column in the slicer. |
GetColumnWidthPixel() | Gets or sets the width in unit of pixels for each column of the slicer. |
GetHeight() | Returns or sets the height of the specified slicer, in points. |
GetHeightPixel() | Returns or sets the height of the specified slicer, in pixels. |
GetLeftPixel() | Returns or sets the horizontal offset of slicer shape from its left column, in pixels. |
GetLockedAspectRatio() | Indicates whether locking aspect ratio. |
GetLockedPosition() | Indicates whether the specified slicer can be moved or resized by using the user interface. |
GetName() | Returns or sets the name of the specified slicer. |
GetNumberOfColumns() | Returns or sets the number of columns in the specified slicer. |
GetParent() | Returns the Worksheet object which contains this slicer. Read-only. |
GetPlacement() | 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() | Returns or sets the height, in points, of each row in the specified slicer. |
GetRowHeightPixel() | Returns or sets the height, in pixels, of each row in the specified slicer. |
GetSlicerCache() | Returns the SlicerCache object associated with the slicer. Read-only. |
GetStyleType() | Specify the type of Built-in slicer style the default type is SlicerStyleLight1. |
GetTitle() | Specifies the title of the current Slicer object. |
GetTopPixel() | Returns or sets the vertical offset of slicer shape from its top row, in pixels. |
GetWidth() | Returns or sets the width of the specified slicer, in points. |
GetWidthPixel() | Returns or sets the width of the specified slicer, in pixels. |
IsLocked() | Indicates whether the slicer shape is locked. |
IsNull() const | Checks whether the implementation object is nullptr. |
IsPrintable() | Indicates whether the slicer object is printable. |
explicit operator bool() const | operator bool() |
operator=(const Slicer& src) | operator= |
Refresh() | Refreshing the slicer.Meanwhile, Refreshing and Calculating relative PivotTables. |
RemovePivotConnection(const PivotTable& pivot) | Removes PivotTable connection. |
SetAlternativeText(const U16String& value) | Returns or sets the descriptive (alternative) text string of the Slicer object. |
SetAlternativeText(const char16_t* value) | Returns or sets the descriptive (alternative) text string of the Slicer object. |
SetCaption(const U16String& value) | Returns or sets the caption of the specified slicer. |
SetCaption(const char16_t* value) | Returns or sets the caption of the specified slicer. |
SetCaptionVisible(bool value) | Returns or sets whether the header that displays the slicer Caption is visible the default value is true. |
SetColumnWidth(double value) | Returns or sets the width, in points, of each column in the slicer. |
SetColumnWidthPixel(int32_t value) | Gets or sets the width in unit of pixels for each column of the slicer. |
SetHeight(double value) | Returns or sets the height of the specified slicer, in points. |
SetHeightPixel(int32_t value) | Returns or sets the height of the specified slicer, in pixels. |
SetIsLocked(bool value) | Indicates whether the slicer shape is locked. |
SetIsPrintable(bool value) | Indicates whether the slicer object is printable. |
SetLeftPixel(int32_t value) | Returns or sets the horizontal offset of slicer shape from its left column, in pixels. |
SetLockedAspectRatio(bool value) | Indicates whether locking aspect ratio. |
SetLockedPosition(bool value) | Indicates whether the specified slicer can be moved or resized by using the user interface. |
SetName(const U16String& value) | Returns or sets the name of the specified slicer. |
SetName(const char16_t* value) | Returns or sets the name of the specified slicer. |
SetNumberOfColumns(int32_t value) | Returns or sets the number of columns in the specified slicer. |
SetPlacement(PlacementType value) | 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) | Returns or sets the height, in points, of each row in the specified slicer. |
SetRowHeightPixel(int32_t value) | Returns or sets the height, in pixels, of each row in the specified slicer. |
SetStyleType(SlicerStyleType value) | Specify the type of Built-in slicer style the default type is SlicerStyleLight1. |
SetTitle(const U16String& value) | Specifies the title of the current Slicer object. |
SetTitle(const char16_t* value) | Specifies the title of the current Slicer object. |
SetTopPixel(int32_t value) | Returns or sets the vertical offset of slicer shape from its top row, in pixels. |
SetWidth(double value) | Returns or sets the width of the specified slicer, in points. |
SetWidthPixel(int32_t value) | Returns or sets the width of the specified slicer, in pixels. |
Slicer(Slicer_Impl* impl) | Constructs from an implementation object. |
Slicer(const Slicer& src) | Copy constructor. |
~Slicer() | Destructor. |
Fields
Field | Description |
---|---|
_impl | The implementation object. |
Examples
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++