Interface ISlicer
Represents the Slicer in a worksheet
Namespace: Syncfusion.XlsIO
Assembly: Syncfusion.XlsIO.Portable.dll
Syntax
public interface ISlicer
Properties
Caption
Gets or sets the caption of the slicer in the worksheet.
Declaration
string Caption { get; set; }
Property Value
Type |
---|
System.String |
Examples
Following code illustrates how to get and change the slicer Caption.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Slicer.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
ISlicer slicer = worksheet.Slicers[0];
string name = slicer.Caption;
slicer.Caption = "Sample";
workbook.SaveAs("Slicer.xlsx");
workbook.Close();
excelEngine.Dispose();
}
DisplayHeader
Indicates whether the slicer caption need to be visible or not.
Declaration
bool DisplayHeader { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
Following code illustrates how to change the DisplayHeader option of the slicer.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Slicer.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
ISlicer slicer = worksheet.Slicers[0];
slicer.DisplayHeader = false;
workbook.SaveAs("Slicer.xlsx");
workbook.Close();
excelEngine.Dispose();
}
Height
Gets or sets the height of the slicer, in points.
Declaration
double Height { get; set; }
Property Value
Type |
---|
System.Double |
Examples
Following code illustrates how to set the Height of the slicer.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Slicer.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
ISlicer slicer = worksheet.Slicers[0];
slicer.Height = 200;
workbook.SaveAs("Slicer.xlsx");
workbook.Close();
excelEngine.Dispose();
}
HeightInPixels
Gets or sets the height of the slicer, in pixel.
Declaration
int HeightInPixels { get; set; }
Property Value
Type |
---|
System.Int32 |
Examples
Following code illustrates how to set the Height of the slicer.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Slicer.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
ISlicer slicer = worksheet.Slicers[0];
slicer.Height = 200;
workbook.SaveAs("Slicer.xlsx");
workbook.Close();
excelEngine.Dispose();
}
Left
Gets or sets the horizontal position of the slicer, in points.
Declaration
double Left { get; set; }
Property Value
Type |
---|
System.Double |
Examples
Following code illustrates how to set the Left position of the slicer.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Slicer.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
ISlicer slicer = worksheet.Slicers[0];
slicer.Left = 300;
workbook.SaveAs("Slicer.xlsx");
workbook.Close();
excelEngine.Dispose();
}
Name
Gets or sets the name of the slicer in the worksheet.
Declaration
string Name { get; set; }
Property Value
Type |
---|
System.String |
Examples
Following code illustrates how to get and change the slicer name.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Slicer.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
ISlicer slicer = worksheet.Slicers[0];
string name = slicer.Name;
slicer.Name = "Sample Slicer";
workbook.SaveAs("Slicer.xlsx");
workbook.Close();
excelEngine.Dispose();
}
NumberOfColumns
Gets or sets the number of columns in the slicer.
Declaration
int NumberOfColumns { get; set; }
Property Value
Type |
---|
System.Int32 |
Examples
Following code illustrates how to gets or sets the Number of columns in the slicer.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Slicer.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
ISlicer slicer = worksheet.Slicers[0];
slicer.NumberOfColumns = 2;
workbook.SaveAs("Slicer.xlsx");
workbook.Close();
excelEngine.Dispose();
}
SlicerCache
Gets the slicer cahce of the slicer
Declaration
ISlicerCache SlicerCache { get; }
Property Value
Type |
---|
ISlicerCache |
Examples
Following code illustrates how to get the Slicer Cache of the slicer.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Slicer.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
ISlicerCache cache = worksheet.Slicers[0].SlicerCache;
workbook.SaveAs("Slicer.xlsx");
workbook.Close();
excelEngine.Dispose();
}
SlicerItemHeight
Gets or sets the height, in points, of each row in the slicer.
Declaration
double SlicerItemHeight { get; set; }
Property Value
Type |
---|
System.Double |
Examples
Following code illustrates how to set the Height of the slicer button.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Slicer.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
ISlicer slicer = worksheet.Slicers[0];
slicer.SlicerItemHeight = 0.4;
workbook.SaveAs("Slicer.xlsx");
workbook.Close();
excelEngine.Dispose();
}
SlicerItemHeightInPixels
Gets or sets the height, in pixel, of each row in the slicer.
Declaration
int SlicerItemHeightInPixels { get; set; }
Property Value
Type |
---|
System.Int32 |
Examples
Following code illustrates how to set the Height of the slicer button.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Slicer.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
ISlicer slicer = worksheet.Slicers[0];
slicer.SlicerItemHeight = 0.4;
workbook.SaveAs("Slicer.xlsx");
workbook.Close();
excelEngine.Dispose();
}
SlicerItemWidth
Gets or sets the width, in points, of each column in the slicer.
Declaration
double SlicerItemWidth { get; set; }
Property Value
Type |
---|
System.Double |
Examples
Following code illustrates how to set the Width of the slicer button.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Slicer.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
ISlicer slicer = worksheet.Slicers[0];
slicer.SlicerItemWidth = 80;
workbook.SaveAs("Slicer.xlsx");
workbook.Close();
excelEngine.Dispose();
}
SlicerItemWidthInPixels
Gets or sets the width, in pixel, of each column in the slicer.
Declaration
int SlicerItemWidthInPixels { get; set; }
Property Value
Type |
---|
System.Int32 |
Examples
Following code illustrates how to set the Width of the slicer button.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Slicer.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
ISlicer slicer = worksheet.Slicers[0];
slicer.SlicerItemWidth = 80;
workbook.SaveAs("Slicer.xlsx");
workbook.Close();
excelEngine.Dispose();
}
SlicerStyle
Gets or sets the slicer style
Declaration
ExcelSlicerStyle SlicerStyle { get; set; }
Property Value
Type |
---|
ExcelSlicerStyle |
Examples
Following code illustrates how to change the slicer style.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Slicer.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
ISlicer slicer = worksheet.Slicers[0];
slicer.SlicerStyle = ExcelSlicerStyle.SlicerStyleDark2;
workbook.SaveAs("Slicer.xlsx");
workbook.Close();
excelEngine.Dispose();
}
SourceTable
Gets the parent table of the slicer. Read only.
Declaration
IListObject SourceTable { get; }
Property Value
Type |
---|
IListObject |
Examples
Following code illustrates how to get the source table of the slicer.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Slicer.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
ISlicer slicer = worksheet.Slicers[0];
IListObject table1 = slicer.SourceTable;
workbook.SaveAs("Slicer.xlsx");
workbook.Close();
excelEngine.Dispose();
}
Top
Gets or sets the vertical position of the slicer, in points.
Declaration
double Top { get; set; }
Property Value
Type |
---|
System.Double |
Examples
Following code illustrates how to set the Top position of the slicer.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Slicer.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
ISlicer slicer = worksheet.Slicers[0];
slicer.Top = 100;
workbook.SaveAs("Slicer.xlsx");
workbook.Close();
excelEngine.Dispose();
}
Width
Gets or sets the width of the slicer, in points.
Declaration
double Width { get; set; }
Property Value
Type |
---|
System.Double |
Examples
Following code illustrates how to set the Width of the slicer.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Slicer.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
ISlicer slicer = worksheet.Slicers[0];
slicer.Width = 150;
workbook.SaveAs("Slicer.xlsx");
workbook.Close();
excelEngine.Dispose();
}
WidthInPixels
Gets or sets the width of the slicer, in pixel.
Declaration
int WidthInPixels { get; set; }
Property Value
Type |
---|
System.Int32 |
Examples
Following code illustrates how to set the Width of the slicer.
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Slicer.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
ISlicer slicer = worksheet.Slicers[0];
slicer.Width = 150;
workbook.SaveAs("Slicer.xlsx");
workbook.Close();
excelEngine.Dispose();
}