diff --git a/FAQ/Unathorize_Exception/.NET/Unauthorize_Exception/Unauthorize_Exception.slnx b/FAQ/Unathorize_Exception/.NET/Unauthorize_Exception/Unauthorize_Exception.slnx new file mode 100644 index 00000000..c3e22e87 --- /dev/null +++ b/FAQ/Unathorize_Exception/.NET/Unauthorize_Exception/Unauthorize_Exception.slnx @@ -0,0 +1,3 @@ + + + diff --git a/FAQ/Unathorize_Exception/.NET/Unauthorize_Exception/Unauthorize_Exception/Data/InputTemplate.xlsm b/FAQ/Unathorize_Exception/.NET/Unauthorize_Exception/Unauthorize_Exception/Data/InputTemplate.xlsm new file mode 100644 index 00000000..829f03c9 Binary files /dev/null and b/FAQ/Unathorize_Exception/.NET/Unauthorize_Exception/Unauthorize_Exception/Data/InputTemplate.xlsm differ diff --git a/FAQ/Unathorize_Exception/.NET/Unauthorize_Exception/Unauthorize_Exception/Output/.gitkeep b/FAQ/Unathorize_Exception/.NET/Unauthorize_Exception/Unauthorize_Exception/Output/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/FAQ/Unathorize_Exception/.NET/Unauthorize_Exception/Unauthorize_Exception/Program.cs b/FAQ/Unathorize_Exception/.NET/Unauthorize_Exception/Unauthorize_Exception/Program.cs new file mode 100644 index 00000000..9131c5bb --- /dev/null +++ b/FAQ/Unathorize_Exception/.NET/Unauthorize_Exception/Unauthorize_Exception/Program.cs @@ -0,0 +1,28 @@ +using Syncfusion.XlsIO; + +class Program +{ + static void Main(string[] args) + { + //Create an instance of ExcelEngine + using (ExcelEngine excelEngine = new ExcelEngine()) + { + //Set the default version as Excel 2016 + excelEngine.Excel.DefaultVersion = ExcelVersion.Excel2016; + + File.SetAttributes(Path.GetFullPath("Data/InputTemplate.xlsm"), FileAttributes.Normal); + + //Create a workbook + IWorkbook workbook = excelEngine.Excel.Workbooks.Open(Path.GetFullPath("Data/InputTemplate.xlsm")); + + IWorksheet worksheet = workbook.Worksheets[0]; + + worksheet.Range["A2"].Text = "Hello, World!"; + + File.SetAttributes(Path.GetFullPath("Data/InputTemplate.xlsm"), FileAttributes.Hidden); + + //Save the workbook to disk in xlsx format + workbook.SaveAs(Path.GetFullPath("Output/Output.xlsm")); + } + } +} diff --git a/FAQ/Unathorize_Exception/.NET/Unauthorize_Exception/Unauthorize_Exception/Unauthorize_Exception.csproj b/FAQ/Unathorize_Exception/.NET/Unauthorize_Exception/Unauthorize_Exception/Unauthorize_Exception.csproj new file mode 100644 index 00000000..9911aad6 --- /dev/null +++ b/FAQ/Unathorize_Exception/.NET/Unauthorize_Exception/Unauthorize_Exception/Unauthorize_Exception.csproj @@ -0,0 +1,23 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + + + Always + + + Always + + + +