[]
Represents a slicer in a Workbook.
A slicer is a visual filter control for a table or PivotTable. You can use an ISlicer
to display filter choices, apply slicer styles, and configure the slicer's layout and display
settings on a worksheet.
public interface ISlicer
Public Interface ISlicer
worksheet.Range["A1:B4"].Value = new object[,] {
{"Category", "Amount"},
{"Fruit", 100},
{"Vegetables", 200},
{"Fruit", 150}
};
ITable table = worksheet.Tables.Add(worksheet.Range["A1:B4"], true);
ISlicerCache cache = workbook.SlicerCaches.Add(table, "Category", "categoryCache");
ISlicer slicer = cache.Slicers.Add(worksheet, "categorySlicer", "Category", 30, 100, 120, 160);
| Name | Description |
|---|---|
| Caption | Gets or sets the caption of the specified slicer. |
| DisplayHeader | Gets or sets whether the header that displays the slicer's caption is visible. Use this property to determine whether the slicer shows its caption header. |
| Height | Gets or sets the height of the slicer, in points. Use this property to retrieve the current vertical size of a slicer on the worksheet. |
| Left | Gets or sets the horizontal position of the specified slicer, in points, relative to the upper-left corner of cell A1 on a worksheet. Use this property to retrieve the current left offset of the slicer on the worksheet. |
| Name | Gets or sets the name of the slicer. |
| NumberOfColumns | Gets or sets the number of columns used to display items in the slicer. Use this property to determine the current slicer layout when slicer items are arranged in multiple columns. |
| RowHeight | Gets or sets the height, in points, of each row in the specified slicer. This value controls the height of the item rows displayed in the slicer. |
| Shape | Gets the IShape object associated with the slicer. Use the returned shape to access drawing-level properties of the slicer, such as its position, size, and other shape settings on the worksheet. |
| SlicerCache | Gets the ISlicerCache object associated with the slicer. The returned slicer cache contains the shared filtering data and settings that the slicer uses. |
| Style | Gets or sets the style currently applied to the specified slicer. |
| Top | Gets or sets the vertical position of the specified slicer, in points, relative to the upper-left corner of cell A1 on a worksheet. Use this property to determine the slicer's current top offset on its worksheet. |
| Width | Gets or sets the width of the specified slicer, in points. Use this property to retrieve the current horizontal size of the slicer on the worksheet. |
| Name | Description |
|---|---|
| Delete() | Deletes the slicer and removes it from the associated ISlicers collection. |
| FromJson(string) | Updates the slicer settings from the specified JSON string. Use this method to apply slicer settings that were generated by ToJson() to an existing slicer. |
| ToJson() | Generates a JSON string from this slicer. Use this method to serialize the current slicer settings so that they can be applied later by using FromJson(string). |