diff --git a/Use Cases/Hide filter from table/.NET/Hide filter from table/Hide filter from table.sln b/Use Cases/Hide filter from table/.NET/Hide filter from table/Hide filter from table.sln new file mode 100644 index 00000000..504f208b --- /dev/null +++ b/Use Cases/Hide filter from table/.NET/Hide filter from table/Hide filter from table.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36127.28 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Clear filter from table", "Clear filter from table\Clear filter from table.csproj", "{CF798281-D9F5-47BB-986E-3F9EA4478D43}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CF798281-D9F5-47BB-986E-3F9EA4478D43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CF798281-D9F5-47BB-986E-3F9EA4478D43}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CF798281-D9F5-47BB-986E-3F9EA4478D43}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CF798281-D9F5-47BB-986E-3F9EA4478D43}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A5816C6A-9F3D-49D4-BC70-E99F3FB75C38} + EndGlobalSection +EndGlobal diff --git a/Use Cases/Hide filter from table/.NET/Hide filter from table/Hide filter from table/Data/InputTemplate.xlsx b/Use Cases/Hide filter from table/.NET/Hide filter from table/Hide filter from table/Data/InputTemplate.xlsx new file mode 100644 index 00000000..6c049017 Binary files /dev/null and b/Use Cases/Hide filter from table/.NET/Hide filter from table/Hide filter from table/Data/InputTemplate.xlsx differ diff --git a/Use Cases/Hide filter from table/.NET/Hide filter from table/Hide filter from table/Hide filter from table.csproj b/Use Cases/Hide filter from table/.NET/Hide filter from table/Hide filter from table/Hide filter from table.csproj new file mode 100644 index 00000000..7aaa5dd7 --- /dev/null +++ b/Use Cases/Hide filter from table/.NET/Hide filter from table/Hide filter from table/Hide filter from table.csproj @@ -0,0 +1,24 @@ + + + + Exe + net8.0 + Clear_filter_from_table + enable + enable + + + + + + + + + Always + + + Always + + + + diff --git a/Use Cases/Hide filter from table/.NET/Hide filter from table/Hide filter from table/Output/.gitkeep b/Use Cases/Hide filter from table/.NET/Hide filter from table/Hide filter from table/Output/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Use Cases/Hide filter from table/.NET/Hide filter from table/Hide filter from table/Program.cs b/Use Cases/Hide filter from table/.NET/Hide filter from table/Hide filter from table/Program.cs new file mode 100644 index 00000000..c5765f08 --- /dev/null +++ b/Use Cases/Hide filter from table/.NET/Hide filter from table/Hide filter from table/Program.cs @@ -0,0 +1,34 @@ +using Syncfusion.XlsIO; + +namespace Clear_Filter_From_Table +{ + class Program + { + public static void Main(string[] args) + { + using (ExcelEngine excelEngine = new ExcelEngine()) + { + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + + FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read); + IWorkbook workbook = application.Workbooks.Open(inputStream); + IWorksheet worksheet = workbook.Worksheets[0]; + + //Access the first table (ListObject) in the worksheet + IListObject table = worksheet.ListObjects[0]; + + //Clear filters from the table + table.ShowAutoFilter = false; + + //Saving the workbook + FileStream outputStream = new FileStream(Path.GetFullPath("Output.xlsx"), FileMode.Create, FileAccess.ReadWrite); + workbook.SaveAs(outputStream); + + //Dispose streams + outputStream.Dispose(); + inputStream.Dispose(); + } + } + } +}