From 83a2e12cbf55e535972bafb1beb798e2733ddaa6 Mon Sep 17 00:00:00 2001 From: KarthikaSF4773 Date: Mon, 3 Nov 2025 17:17:45 +0530 Subject: [PATCH] 990137-CustomXmlSupportSample --- .../Add Custom XML/Add Custom XML/Program.cs | 14 ++------------ .../Read Custom XML/Read Custom XML/Program.cs | 17 +++-------------- 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/Custom XML Support/Add Custom XML/.NET/Add Custom XML/Add Custom XML/Program.cs b/Custom XML Support/Add Custom XML/.NET/Add Custom XML/Add Custom XML/Program.cs index 5615675b..f3779db7 100644 --- a/Custom XML Support/Add Custom XML/.NET/Add Custom XML/Add Custom XML/Program.cs +++ b/Custom XML Support/Add Custom XML/.NET/Add Custom XML/Add Custom XML/Program.cs @@ -24,20 +24,10 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/CreateCustomXML.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/CreateCustomXML.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - //Open default JSON } } } -} - - - - - +} \ No newline at end of file diff --git a/Custom XML Support/Read Custom XML/.NET/Read Custom XML/Read Custom XML/Program.cs b/Custom XML Support/Read Custom XML/.NET/Read Custom XML/Read Custom XML/Program.cs index b411646f..022684f4 100644 --- a/Custom XML Support/Read Custom XML/.NET/Read Custom XML/Read Custom XML/Program.cs +++ b/Custom XML Support/Read Custom XML/.NET/Read Custom XML/Read Custom XML/Program.cs @@ -12,8 +12,7 @@ static void Main(string[] args) { 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, ExcelOpenType.Automatic); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"), ExcelOpenType.Automatic); IWorksheet sheet = workbook.Worksheets[0]; //Access CustomXmlPart from Workbook @@ -26,19 +25,9 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ReadXml.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ReadXml.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } -} - - - - - +} \ No newline at end of file