[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.ISlicers.Add

Add Method

Add(IWorksheet, string, string, double, double, double, double)

Creates a slicer on the specified worksheet and returns the new ISlicer.

The slicer is added to this collection and positioned using coordinates measured in points, relative to the upper-left corner of cell A1 on the destination worksheet.

Declaration
ISlicer Add(IWorksheet slicerDestination, string name, string caption, double top, double left, double width, double height)
Function Add(slicerDestination As IWorksheet, name As String, caption As String, top As Double, left As Double, width As Double, height As Double) As ISlicer
Parameters
Type Name Description
IWorksheet slicerDestination

The IWorksheet on which the slicer is placed. The destination worksheet must belong to the workbook that contains this ISlicers collection.

string name

The slicer name. This name must be unique across all slicers in the workbook.

string caption

The caption displayed for the slicer.

double top

The initial vertical position of the slicer, in points, relative to the upper-left corner of cell A1.

double left

The initial horizontal position of the slicer, in points, relative to the upper-left corner of cell A1.

double width

The initial width of the slicer, in points.

double height

The initial height of the slicer, in points.

Returns
Type Description
ISlicer

The created ISlicer.

Examples
worksheet.Range["A1:B4"].Value = new object[,] {
    {"Category", "Amount"},
    {"Fruit", 100},
    {"Vegetable", 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, 200, 120, 160);