diff --git a/FAQ/Chart/.NET/Remove Axis/Remove Axis.slnx b/FAQ/Chart/.NET/Remove Axis/Remove Axis.slnx new file mode 100644 index 00000000..4edbde6f --- /dev/null +++ b/FAQ/Chart/.NET/Remove Axis/Remove Axis.slnx @@ -0,0 +1,3 @@ + + + diff --git a/FAQ/Chart/.NET/Remove Axis/Remove Axis/Data/InputTemplate.xlsx b/FAQ/Chart/.NET/Remove Axis/Remove Axis/Data/InputTemplate.xlsx new file mode 100644 index 00000000..90ce177a Binary files /dev/null and b/FAQ/Chart/.NET/Remove Axis/Remove Axis/Data/InputTemplate.xlsx differ diff --git a/FAQ/Chart/.NET/Remove Axis/Remove Axis/Output/.gitkeep b/FAQ/Chart/.NET/Remove Axis/Remove Axis/Output/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/FAQ/Chart/.NET/Remove Axis/Remove Axis/Program.cs b/FAQ/Chart/.NET/Remove Axis/Remove Axis/Program.cs new file mode 100644 index 00000000..ead3e0a4 --- /dev/null +++ b/FAQ/Chart/.NET/Remove Axis/Remove Axis/Program.cs @@ -0,0 +1,32 @@ +using Syncfusion.XlsIO; + +class Program +{ + static void Main(string[] args) + { + // Create an instance of ExcelEngine + using (ExcelEngine excelEngine = new ExcelEngine()) + { + IApplication application = excelEngine.Excel; + + application.DefaultVersion = ExcelVersion.Xlsx; + + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data\InputTemplate.xlsx")); + + IWorksheet worksheet = workbook.Worksheets[0]; + + IChartShape chart = worksheet.Charts[0]; + + //Removing legend. + chart.HasLegend = false; + + //Removing CategoryAxis. + chart.PrimaryCategoryAxis.Visible = false; + + //Removing ValueAxix. + chart.PrimaryValueAxis.Visible = false; + // Save the workbook to a file + workbook.SaveAs(Path.GetFullPath(@"Output\Output.xlsx")); + } + } +} \ No newline at end of file diff --git a/FAQ/Chart/.NET/Remove Axis/Remove Axis/Remove Axis.csproj b/FAQ/Chart/.NET/Remove Axis/Remove Axis/Remove Axis.csproj new file mode 100644 index 00000000..ffc42bcb --- /dev/null +++ b/FAQ/Chart/.NET/Remove Axis/Remove Axis/Remove Axis.csproj @@ -0,0 +1,24 @@ + + + + Exe + net8.0 + Remove_Axis + enable + enable + + + + + + + + + Always + + + Always + + + +