Skip to content
Merged
Show file tree
Hide file tree
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
25 changes: 25 additions & 0 deletions Use Cases/Slicer/CreateTableSlicer.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36109.1 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CreateTableSlicer", "CreateTableSlicer\CreateTableSlicer.csproj", "{FB4FEB74-2019-43D4-A115-50F803A3BFB7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FB4FEB74-2019-43D4-A115-50F803A3BFB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FB4FEB74-2019-43D4-A115-50F803A3BFB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FB4FEB74-2019-43D4-A115-50F803A3BFB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FB4FEB74-2019-43D4-A115-50F803A3BFB7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9788A549-8F0C-425D-94BA-DDDCD26FC01B}
EndGlobalSection
EndGlobal
25 changes: 25 additions & 0 deletions Use Cases/Slicer/CreateTableSlicer/CreateTableSlicer.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Create_Slicer</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.XlsIO.NET" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Data\*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>



Binary file not shown.
Empty file.
61 changes: 61 additions & 0 deletions Use Cases/Slicer/CreateTableSlicer/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using System.IO;
using Syncfusion.XlsIO;

namespace CreateTableSlicer
{
class Program
{
static void Main(string[] args)
{
// Initialize ExcelEngine
using (ExcelEngine excelEngine = new ExcelEngine())
{
// Set the default application version as Xlsx
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;

//Open existing workbook with data
IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"), ExcelOpenType.Automatic);

//Access first worksheet from the workbook.
IWorksheet sheet = workbook.Worksheets[0];

//Access the table.
IListObject table = sheet.ListObjects[0];


//Add Slicer to the Requester column(4th column) from the table at 11th row and 2nd column.
sheet.Slicers.Add(table, 4, 11, 2);

// Modify Slicer properties
ISlicer slicer = sheet.Slicers[0];

// Set Slicer caption, name, and size
slicer.Caption = "Select Assignee";
slicer.Name = "Assignees";
slicer.Height = 200;
slicer.Width = 200;

//Apply built-in style for requester slicer
slicer.SlicerStyle = ExcelSlicerStyle.SlicerStyleDark1;

// Add Slicer to the Status column (5th column) from the table at 11th row and 4th column.
sheet.Slicers.Add(table, 5, 11, 4);

// Modify Slicer properties
slicer = sheet.Slicers[1];
slicer.Caption = "Select Status";
slicer.Name = "Status";
slicer.Height = 200;
slicer.Width = 200;


//Apply built-in style for status slicer
slicer.SlicerStyle = ExcelSlicerStyle.SlicerStyleLight2;

//Save the workbook
workbook.SaveAs(Path.GetFullPath("Output/CreateTableSlicer.xlsx"));
}
}
}
}