diff --git a/Import Data to Template/Conditional Formatting/.NET/Conditional Formatting/Conditional Formatting/Program.cs b/Import Data to Template/Conditional Formatting/.NET/Conditional Formatting/Conditional Formatting/Program.cs index e3ce1b46..8e7fb3af 100644 --- a/Import Data to Template/Conditional Formatting/.NET/Conditional Formatting/Conditional Formatting/Program.cs +++ b/Import Data to Template/Conditional Formatting/.NET/Conditional Formatting/Conditional Formatting/Program.cs @@ -14,8 +14,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 worksheet = workbook.Worksheets[0]; //Create Template Marker Processor @@ -121,13 +120,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ConditionalFormatting.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ConditionalFormatting.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } public static IList GetSalesReports() diff --git a/Import Data to Template/Import Array/.NET/Import Array/Import Array/Program.cs b/Import Data to Template/Import Array/.NET/Import Array/Import Array/Program.cs index 952191ee..1ca2c8f2 100644 --- a/Import Data to Template/Import Array/.NET/Import Array/Import Array/Program.cs +++ b/Import Data to Template/Import Array/.NET/Import Array/Import Array/Program.cs @@ -13,8 +13,7 @@ public static void Main(string[] args) application.DefaultVersion = ExcelVersion.Xlsx; // Open an existing workbook. - 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); // Create Template Marker Processor. ITemplateMarkersProcessor marker = workbook.CreateTemplateMarkersProcessor(); @@ -31,12 +30,8 @@ public static void Main(string[] args) marker.ApplyMarkers(); // Saving the workbook. - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ImportArray.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ImportArray.xlsx")); - //Dispose streams - inputStream.Dispose(); - outputStream.Dispose(); } } } diff --git a/Import Data to Template/Import Collection/.NET/Import Collection/Import Collection/Program.cs b/Import Data to Template/Import Collection/.NET/Import Collection/Import Collection/Program.cs index e42b852e..eb8241fe 100644 --- a/Import Data to Template/Import Collection/.NET/Import Collection/Import Collection/Program.cs +++ b/Import Data to Template/Import Collection/.NET/Import Collection/Import Collection/Program.cs @@ -13,8 +13,7 @@ public static void Main(string[] args) application.DefaultVersion = ExcelVersion.Xlsx; // Open an existing workbook. - FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); // Create Template Marker Processor. ITemplateMarkersProcessor marker = workbook.CreateTemplateMarkersProcessor(); @@ -29,12 +28,7 @@ public static void Main(string[] args) marker.ApplyMarkers(); // Saving the workbook. - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ImportCollection.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); - - //Dispose streams - inputStream.Dispose(); - outputStream.Dispose(); + workbook.SaveAs(Path.GetFullPath("Output/ImportCollection.xlsx")); } // Gets a list of sales reports. private static List GetSalesReports() diff --git a/Import Data to Template/Import Data Table/.NET/Import Data Table/Import Data Table/Program.cs b/Import Data to Template/Import Data Table/.NET/Import Data Table/Import Data Table/Program.cs index 0ea9e909..9ff1f07a 100644 --- a/Import Data to Template/Import Data Table/.NET/Import Data Table/Import Data Table/Program.cs +++ b/Import Data to Template/Import Data Table/.NET/Import Data Table/Import Data Table/Program.cs @@ -13,8 +13,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 worksheet = workbook.Worksheets[0]; //Create Template Marker Processor @@ -42,13 +41,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ImportDataTable.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ImportDataTable.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Import Data to Template/Import Nested Collection/.NET/Import Nested Collection/Import Nested Collection/Program.cs b/Import Data to Template/Import Nested Collection/.NET/Import Nested Collection/Import Nested Collection/Program.cs index c04c582c..dc699779 100644 --- a/Import Data to Template/Import Nested Collection/.NET/Import Nested Collection/Import Nested Collection/Program.cs +++ b/Import Data to Template/Import Nested Collection/.NET/Import Nested Collection/Import Nested Collection/Program.cs @@ -13,8 +13,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 worksheet = workbook.Worksheets[0]; //Create Template Marker Processor @@ -28,13 +27,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ImportNestedCollection.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ImportNestedCollection.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } //Get sales Report class diff --git a/Import Data to Template/Import with Hyperlinks/.NET/Import with Hyperlinks/Import with Hyperlinks/Program.cs b/Import Data to Template/Import with Hyperlinks/.NET/Import with Hyperlinks/Import with Hyperlinks/Program.cs index b16bb874..1bdef13e 100644 --- a/Import Data to Template/Import with Hyperlinks/.NET/Import with Hyperlinks/Import with Hyperlinks/Program.cs +++ b/Import Data to Template/Import with Hyperlinks/.NET/Import with Hyperlinks/Import with Hyperlinks/Program.cs @@ -13,8 +13,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 worksheet = workbook.Worksheets[0]; //Create Template Marker Processor @@ -28,13 +27,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/HyperlinkWithMarker.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/HyperlinkWithMarker.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } //Gets a list of company details diff --git a/Import Data to Template/Set Template Marker/.NET/Set Template Marker/Set Template Marker/Program.cs b/Import Data to Template/Set Template Marker/.NET/Set Template Marker/Set Template Marker/Program.cs index d0c5d270..4432e4aa 100644 --- a/Import Data to Template/Set Template Marker/.NET/Set Template Marker/Set Template Marker/Program.cs +++ b/Import Data to Template/Set Template Marker/.NET/Set Template Marker/Set Template Marker/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 worksheet = workbook.Worksheets[0]; //Insert Simple marker @@ -34,13 +33,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/TemplateMarker.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/TemplateMarker.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } }