Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions Document-Processing/Excel/Excel-Library/NET/Slicer.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
IWorksheet sheet = workbook.Worksheets[0];

//Access the table.
Expand All @@ -35,9 +34,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
//Add slicer for the table.
sheet.Slicers.Add(table, 3, 11, 2);

FileStream stream = new FileStream("Output.xlsx", FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAs(stream);
stream.Dispose();
workbook.SaveAs("Output.xlsx");
}
{% endhighlight %}

Expand Down Expand Up @@ -266,8 +263,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic);
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic);
IWorksheet sheet = workbook.Worksheets[0];

//Access the table
Expand Down Expand Up @@ -306,9 +302,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
//Slicer style
slicer.SlicerStyle = ExcelSlicerStyle.SlicerStyleDark2;

FileStream stream = new FileStream("Output.xlsx", FileMode.Create, FileAccess.ReadWrite);
workbook.SaveAs(stream);
stream.Dispose();
workbook.SaveAs("Output.xlsx");
}
{% endhighlight %}

Expand Down