diff --git a/Editing Excel cells/Access Cell or Range/.NET/Access Cell or Range/Access Cell or Range/Program.cs b/Editing Excel cells/Access Cell or Range/.NET/Access Cell or Range/Access Cell or Range/Program.cs index ce59c64b..beee755e 100644 --- a/Editing Excel cells/Access Cell or Range/.NET/Access Cell or Range/Access Cell or Range/Program.cs +++ b/Editing Excel cells/Access Cell or Range/.NET/Access Cell or Range/Access Cell or Range/Program.cs @@ -35,12 +35,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/AccessCellorRange.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/AccessCellorRange.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } } } diff --git a/Editing Excel cells/Access Discontinuous Range/.NET/Access Discontinuous Range/Access Discontinuous Range/Program.cs b/Editing Excel cells/Access Discontinuous Range/.NET/Access Discontinuous Range/Access Discontinuous Range/Program.cs index 73d3013d..fac46fb3 100644 --- a/Editing Excel cells/Access Discontinuous Range/.NET/Access Discontinuous Range/Access Discontinuous Range/Program.cs +++ b/Editing Excel cells/Access Discontinuous Range/.NET/Access Discontinuous Range/Access Discontinuous Range/Program.cs @@ -28,12 +28,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/DiscontinuousRange.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/DiscontinuousRange.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } } } diff --git a/Editing Excel cells/Access Migrant Range/.NET/Access Migrant Range/Access Migrant Range/Program.cs b/Editing Excel cells/Access Migrant Range/.NET/Access Migrant Range/Access Migrant Range/Program.cs index b24d7ada..94b1e702 100644 --- a/Editing Excel cells/Access Migrant Range/.NET/Access Migrant Range/Access Migrant Range/Program.cs +++ b/Editing Excel cells/Access Migrant Range/.NET/Access Migrant Range/Access Migrant Range/Program.cs @@ -32,12 +32,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/MigrantRange.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/MigrantRange.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } } } diff --git a/Editing Excel cells/Access Relative Range/.NET/Access Relative Range/Access Relative Range/Program.cs b/Editing Excel cells/Access Relative Range/.NET/Access Relative Range/Access Relative Range/Program.cs index 54a6564f..d977b344 100644 --- a/Editing Excel cells/Access Relative Range/.NET/Access Relative Range/Access Relative Range/Program.cs +++ b/Editing Excel cells/Access Relative Range/.NET/Access Relative Range/Access Relative Range/Program.cs @@ -35,12 +35,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/AccessRelativeRange.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/AccessRelativeRange.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } } } diff --git a/Editing Excel cells/Accessing Filter/.NET/Accessing Filter/Accessing Filter/Program.cs b/Editing Excel cells/Accessing Filter/.NET/Accessing Filter/Accessing Filter/Program.cs index f43a78a2..375a1660 100644 --- a/Editing Excel cells/Accessing Filter/.NET/Accessing Filter/Accessing Filter/Program.cs +++ b/Editing Excel cells/Accessing Filter/.NET/Accessing Filter/Accessing Filter/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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Accessing Filter @@ -61,8 +60,7 @@ static void Main(string[] args) } #endregion - //Dispose streams - inputStream.Dispose(); + workbook.SaveAs("Output.xlsx"); } } } diff --git a/Editing Excel cells/Advanced Filter/.NET/Advanced Filter/Advanced Filter/Program.cs b/Editing Excel cells/Advanced Filter/.NET/Advanced Filter/Advanced Filter/Program.cs index e920e7ef..074aa5fc 100644 --- a/Editing Excel cells/Advanced Filter/.NET/Advanced Filter/Advanced Filter/Program.cs +++ b/Editing Excel cells/Advanced Filter/.NET/Advanced Filter/Advanced Filter/Program.cs @@ -11,8 +11,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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Advanced Filter @@ -26,13 +25,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/AdvancedFilter.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/AdvancedFilter.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Editing Excel cells/Cell Color Filter/.NET/Cell Color Filter/Cell Color Filter/Program.cs b/Editing Excel cells/Cell Color Filter/.NET/Cell Color Filter/Cell Color Filter/Program.cs index 50efc64e..93edf9e6 100644 --- a/Editing Excel cells/Cell Color Filter/.NET/Cell Color Filter/Cell Color Filter/Program.cs +++ b/Editing Excel cells/Cell Color Filter/.NET/Cell Color Filter/Cell Color Filter/Program.cs @@ -11,8 +11,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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Cell Color Filter @@ -28,13 +27,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/CellColorFilter.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/CellColorFilter.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Editing Excel cells/Clear Content/.NET/Clear Content/Clear Content/Program.cs b/Editing Excel cells/Clear Content/.NET/Clear Content/Clear Content/Program.cs index afd1bf0e..69ec5db4 100644 --- a/Editing Excel cells/Clear Content/.NET/Clear Content/Clear Content/Program.cs +++ b/Editing Excel cells/Clear Content/.NET/Clear Content/Clear Content/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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Clear Content @@ -23,13 +22,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ClearContent.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ClearContent.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Editing Excel cells/Combination Filter/.NET/Combination Filter/Combination Filter/Program.cs b/Editing Excel cells/Combination Filter/.NET/Combination Filter/Combination Filter/Program.cs index a4579ae5..81c4ad3b 100644 --- a/Editing Excel cells/Combination Filter/.NET/Combination Filter/Combination Filter/Program.cs +++ b/Editing Excel cells/Combination Filter/.NET/Combination Filter/Combination Filter/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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Combination Filter @@ -35,13 +34,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/CombinationFilter.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/CombinationFilter.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Editing Excel cells/Custom Filter/.NET/Custom Filter/Custom Filter/Program.cs b/Editing Excel cells/Custom Filter/.NET/Custom Filter/Custom Filter/Program.cs index 41c861a2..3be12c0f 100644 --- a/Editing Excel cells/Custom Filter/.NET/Custom Filter/Custom Filter/Program.cs +++ b/Editing Excel cells/Custom Filter/.NET/Custom Filter/Custom Filter/Program.cs @@ -11,8 +11,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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Custom Filter @@ -33,13 +32,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/CustomFilter.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/CustomFilter.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Editing Excel cells/Dynamic Filter/.NET/Dynamic Filter/Dynamic Filter/Program.cs b/Editing Excel cells/Dynamic Filter/.NET/Dynamic Filter/Dynamic Filter/Program.cs index b3d9465c..c3054b50 100644 --- a/Editing Excel cells/Dynamic Filter/.NET/Dynamic Filter/Dynamic Filter/Program.cs +++ b/Editing Excel cells/Dynamic Filter/.NET/Dynamic Filter/Dynamic Filter/Program.cs @@ -11,8 +11,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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Dynamic Filter @@ -28,13 +27,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/DynamicFilter.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/DynamicFilter.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Editing Excel cells/Filter/.NET/Filter/Filter/Program.cs b/Editing Excel cells/Filter/.NET/Filter/Filter/Program.cs index ec7d1abe..0462c133 100644 --- a/Editing Excel cells/Filter/.NET/Filter/Filter/Program.cs +++ b/Editing Excel cells/Filter/.NET/Filter/Filter/Program.cs @@ -11,8 +11,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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Filter @@ -32,13 +31,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/Filter.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/Filter.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Editing Excel cells/Find/.NET/Find/Find/Program.cs b/Editing Excel cells/Find/.NET/Find/Find/Program.cs index c6e12a97..2ea66e41 100644 --- a/Editing Excel cells/Find/.NET/Find/Find/Program.cs +++ b/Editing Excel cells/Find/.NET/Find/Find/Program.cs @@ -11,8 +11,7 @@ public static void Main(string[] args) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; - FileStream fileStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(fileStream); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; //Searches for the given string within the text of worksheet @@ -69,10 +68,8 @@ public static void Main(string[] args) cell.CellStyle.Color = Syncfusion.Drawing.Color.FromArgb(255, 0, 128, 128); } - //Saving the workbook as stream - FileStream stream = new FileStream(Path.GetFullPath(@"Output/Find.xlsx"), FileMode.Create, FileAccess.ReadWrite); - workbook.SaveAs(stream); - stream.Dispose(); + //Saving the workbook + workbook.SaveAs(Path.GetFullPath(@"Output/Find.xlsx")); } } } diff --git a/Editing Excel cells/Font Color Filter/.NET/Font Color Filter/Font Color Filter/Program.cs b/Editing Excel cells/Font Color Filter/.NET/Font Color Filter/Font Color Filter/Program.cs index d98b54e9..956af763 100644 --- a/Editing Excel cells/Font Color Filter/.NET/Font Color Filter/Font Color Filter/Program.cs +++ b/Editing Excel cells/Font Color Filter/.NET/Font Color Filter/Font Color Filter/Program.cs @@ -11,8 +11,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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Font Color Filter @@ -28,13 +27,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/FontColorFilter.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/FontColorFilter.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Editing Excel cells/Hyperlinks/.NET/Hyperlinks/Hyperlinks/Program.cs b/Editing Excel cells/Hyperlinks/.NET/Hyperlinks/Hyperlinks/Program.cs index db513343..dee6c2e8 100644 --- a/Editing Excel cells/Hyperlinks/.NET/Hyperlinks/Hyperlinks/Program.cs +++ b/Editing Excel cells/Hyperlinks/.NET/Hyperlinks/Hyperlinks/Program.cs @@ -51,12 +51,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/Hyperlinks.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/Hyperlinks.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } } } diff --git a/Editing Excel cells/Icon Filter/.NET/Icon Filter/Icon Filter/Program.cs b/Editing Excel cells/Icon Filter/.NET/Icon Filter/Icon Filter/Program.cs index a9394a9f..9eedf167 100644 --- a/Editing Excel cells/Icon Filter/.NET/Icon Filter/Icon Filter/Program.cs +++ b/Editing Excel cells/Icon Filter/.NET/Icon Filter/Icon Filter/Program.cs @@ -11,8 +11,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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Icon Filter @@ -28,13 +27,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/IconFilter.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/IconFilter.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Editing Excel cells/Modify Hyperlink/.NET/Modify Hyperlink/Modify Hyperlink/Program.cs b/Editing Excel cells/Modify Hyperlink/.NET/Modify Hyperlink/Modify Hyperlink/Program.cs index 048aa18d..b28b37a7 100644 --- a/Editing Excel cells/Modify Hyperlink/.NET/Modify Hyperlink/Modify Hyperlink/Program.cs +++ b/Editing Excel cells/Modify Hyperlink/.NET/Modify Hyperlink/Modify Hyperlink/Program.cs @@ -11,8 +11,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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Modify Hyperlink @@ -23,13 +22,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ModifyHyperlink.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ModifyHyperlink.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Editing Excel cells/Modify Shape Hyperlink/.NET/Modify Shape Hyperlink/Modify Shape Hyperlink/Program.cs b/Editing Excel cells/Modify Shape Hyperlink/.NET/Modify Shape Hyperlink/Modify Shape Hyperlink/Program.cs index cd8d247a..a556bddf 100644 --- a/Editing Excel cells/Modify Shape Hyperlink/.NET/Modify Shape Hyperlink/Modify Shape Hyperlink/Program.cs +++ b/Editing Excel cells/Modify Shape Hyperlink/.NET/Modify Shape Hyperlink/Modify Shape Hyperlink/Program.cs @@ -11,8 +11,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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Modify Shape Hyperlink @@ -27,13 +26,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ModifyShapeHyperlink.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ModifyShapeHyperlink.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Editing Excel cells/Precedent and Dependent Cells/.NET/Precedent and Dependent Cells/Precedent and Dependent Cells/Program.cs b/Editing Excel cells/Precedent and Dependent Cells/.NET/Precedent and Dependent Cells/Precedent and Dependent Cells/Program.cs index 71f98bf1..640c2ce7 100644 --- a/Editing Excel cells/Precedent and Dependent Cells/.NET/Precedent and Dependent Cells/Precedent and Dependent Cells/Program.cs +++ b/Editing Excel cells/Precedent and Dependent Cells/.NET/Precedent and Dependent Cells/Precedent and Dependent Cells/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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Precedents in Worksheet @@ -111,9 +110,6 @@ static void Main(string[] args) } Console.WriteLine(); #endregion - - //Dispose streams - inputStream.Dispose(); } } } diff --git a/Editing Excel cells/Remove Hyperlink/.NET/Remove Hyperlink/Remove Hyperlink/Program.cs b/Editing Excel cells/Remove Hyperlink/.NET/Remove Hyperlink/Remove Hyperlink/Program.cs index d1d5089c..c6ee4c76 100644 --- a/Editing Excel cells/Remove Hyperlink/.NET/Remove Hyperlink/Remove Hyperlink/Program.cs +++ b/Editing Excel cells/Remove Hyperlink/.NET/Remove Hyperlink/Remove Hyperlink/Program.cs @@ -11,8 +11,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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Remove Hyperlink @@ -22,13 +21,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/RemoveHyperlink.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/RemoveHyperlink.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Editing Excel cells/Remove Shape Hyperlink/.NET/Remove Shape Hyperlink/Remove Shape Hyperlink/Program.cs b/Editing Excel cells/Remove Shape Hyperlink/.NET/Remove Shape Hyperlink/Remove Shape Hyperlink/Program.cs index d6521c45..a15d76c7 100644 --- a/Editing Excel cells/Remove Shape Hyperlink/.NET/Remove Shape Hyperlink/Remove Shape Hyperlink/Program.cs +++ b/Editing Excel cells/Remove Shape Hyperlink/.NET/Remove Shape Hyperlink/Remove Shape Hyperlink/Program.cs @@ -11,8 +11,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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath("Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; //Removing hyperlink from sheet with Index @@ -20,13 +19,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/RemoveShapeHyperlink.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/RemoveShapeHyperlink.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Editing Excel cells/Replace/.NET/Replace/Replace/Program.cs b/Editing Excel cells/Replace/.NET/Replace/Replace/Program.cs index 531f0cd0..f7ba20d6 100644 --- a/Editing Excel cells/Replace/.NET/Replace/Replace/Program.cs +++ b/Editing Excel cells/Replace/.NET/Replace/Replace/Program.cs @@ -11,8 +11,7 @@ public static void Main(string[] args) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; - FileStream fileStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(fileStream); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; //Replaces the given string with another string @@ -30,11 +29,9 @@ public static void Main(string[] args) //Replaces the given string with Array worksheet.Replace("Central", new string[] { "Central", "East" }, true); - //Saving the workbook as stream - FileStream stream = new FileStream(Path.GetFullPath("Output/Replace.xlsx"), FileMode.Create, FileAccess.ReadWrite); + //Saving the workbook workbook.Version = ExcelVersion.Xlsx; - workbook.SaveAs(stream); - stream.Dispose(); + workbook.SaveAs(Path.GetFullPath("Output/Replace.xlsx")); } } } diff --git a/Editing Excel cells/Shape Hyperlink/.NET/Shape Hyperlink/Shape Hyperlink/Program.cs b/Editing Excel cells/Shape Hyperlink/.NET/Shape Hyperlink/Shape Hyperlink/Program.cs index 6b25f1ef..0aa184f2 100644 --- a/Editing Excel cells/Shape Hyperlink/.NET/Shape Hyperlink/Shape Hyperlink/Program.cs +++ b/Editing Excel cells/Shape Hyperlink/.NET/Shape Hyperlink/Shape Hyperlink/Program.cs @@ -33,12 +33,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ShapeHyperlink.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ShapeHyperlink.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } } } diff --git a/Editing Excel cells/Sort On Cell Color/.NET/Sort On Cell Color/Sort On Cell Color/Program.cs b/Editing Excel cells/Sort On Cell Color/.NET/Sort On Cell Color/Sort On Cell Color/Program.cs index 9f4ae1fc..0037a9d0 100644 --- a/Editing Excel cells/Sort On Cell Color/.NET/Sort On Cell Color/Sort On Cell Color/Program.cs +++ b/Editing Excel cells/Sort On Cell Color/.NET/Sort On Cell Color/Sort On Cell Color/Program.cs @@ -11,8 +11,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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Sort on Cell Color @@ -49,13 +48,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/SortOnCellColor.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/SortOnCellColor.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Editing Excel cells/Sort On Cell Values/.NET/Sort On Cell Values/Sort On Cell Values/Program.cs b/Editing Excel cells/Sort On Cell Values/.NET/Sort On Cell Values/Sort On Cell Values/Program.cs index aacd6d4b..28e01690 100644 --- a/Editing Excel cells/Sort On Cell Values/.NET/Sort On Cell Values/Sort On Cell Values/Program.cs +++ b/Editing Excel cells/Sort On Cell Values/.NET/Sort On Cell Values/Sort On Cell Values/Program.cs @@ -11,8 +11,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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Sort On Cell Values @@ -46,13 +45,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/SortOnValues.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/SortOnValues.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Editing Excel cells/Sort on Font Color/.NET/Sort on Font Color/Sort on Font Color/Program.cs b/Editing Excel cells/Sort on Font Color/.NET/Sort on Font Color/Sort on Font Color/Program.cs index 9a7eae04..5f25a9d3 100644 --- a/Editing Excel cells/Sort on Font Color/.NET/Sort on Font Color/Sort on Font Color/Program.cs +++ b/Editing Excel cells/Sort on Font Color/.NET/Sort on Font Color/Sort on Font Color/Program.cs @@ -11,8 +11,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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath("Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Sort on Font Color @@ -49,13 +48,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/SortOnFontColor.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/SortOnFontColor.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Editing Excel cells/Sorting Data with Filters/.NET/Sorting Worksheet/Sorting Worksheet/Program.cs b/Editing Excel cells/Sorting Data with Filters/.NET/Sorting Worksheet/Sorting Worksheet/Program.cs index 6ed9b4b5..42719872 100644 --- a/Editing Excel cells/Sorting Data with Filters/.NET/Sorting Worksheet/Sorting Worksheet/Program.cs +++ b/Editing Excel cells/Sorting Data with Filters/.NET/Sorting Worksheet/Sorting Worksheet/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/Input.xlsx"), FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/Input.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; //Access sort fields from AutoFilters @@ -40,13 +39,8 @@ static void Main(string[] args) sorter.Sort(); #region Save - FileStream outputStream = new FileStream(Path.GetFullPath("Output/Output.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/Output.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Format rows and columns/Autofit Rows and Columns/.NET/Autofit Rows and Columns/Autofit Rows and Columns/Program.cs b/Format rows and columns/Autofit Rows and Columns/.NET/Autofit Rows and Columns/Autofit Rows and Columns/Program.cs index 22840a66..3256687c 100644 --- a/Format rows and columns/Autofit Rows and Columns/.NET/Autofit Rows and Columns/Autofit Rows and Columns/Program.cs +++ b/Format rows and columns/Autofit Rows and Columns/.NET/Autofit Rows and Columns/Autofit Rows and Columns/Program.cs @@ -11,8 +11,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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Autofit Rows @@ -33,13 +32,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/AutofitRowsandColumns.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/AutofitRowsandColumns.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Format rows and columns/Delete Rows and Columns/.NET/Delete Rows and Columns/Delete Rows and Columns/Program.cs b/Format rows and columns/Delete Rows and Columns/.NET/Delete Rows and Columns/Delete Rows and Columns/Program.cs index 87914b48..2a90a120 100644 --- a/Format rows and columns/Delete Rows and Columns/.NET/Delete Rows and Columns/Delete Rows and Columns/Program.cs +++ b/Format rows and columns/Delete Rows and Columns/.NET/Delete Rows and Columns/Delete Rows and Columns/Program.cs @@ -11,8 +11,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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Delete Rows @@ -33,13 +32,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/DeleteRowsandColumns.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/DeleteRowsandColumns.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Format rows and columns/Expand or Collapse Groups/.NET/Expand or Collapse Groups/Expand or Collapse Groups/Program.cs b/Format rows and columns/Expand or Collapse Groups/.NET/Expand or Collapse Groups/Expand or Collapse Groups/Program.cs index 1c5168f1..fc2b7d93 100644 --- a/Format rows and columns/Expand or Collapse Groups/.NET/Expand or Collapse Groups/Expand or Collapse Groups/Program.cs +++ b/Format rows and columns/Expand or Collapse Groups/.NET/Expand or Collapse Groups/Expand or Collapse Groups/Program.cs @@ -21,8 +21,7 @@ public void ExpandGroups() { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; - FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate - To Expand.xlsx"), FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate - To Expand.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Expand Groups @@ -37,13 +36,8 @@ public void ExpandGroups() #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ExpandGroups.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ExpandGroups.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } public void CollapseGroups() @@ -52,8 +46,7 @@ public void CollapseGroups() { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; - FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate - To Collapse.xlsx"), FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate - To Collapse.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Collapse Groups @@ -68,13 +61,8 @@ public void CollapseGroups() #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/CollapseGroups.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/CollapseGroups.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Format rows and columns/Group Rows and Columns/.NET/Group Rows and Columns/Group Rows and Columns/Program.cs b/Format rows and columns/Group Rows and Columns/.NET/Group Rows and Columns/Group Rows and Columns/Program.cs index bceedea4..70efb412 100644 --- a/Format rows and columns/Group Rows and Columns/.NET/Group Rows and Columns/Group Rows and Columns/Program.cs +++ b/Format rows and columns/Group Rows and Columns/.NET/Group Rows and Columns/Group Rows and Columns/Program.cs @@ -11,8 +11,7 @@ static void Main(string[] args) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; - FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate - ToGroup.xlsx"), FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate - ToGroup.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Group Rows @@ -29,13 +28,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/GroupRowsandColumns.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/GroupRowsandColumns.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Format rows and columns/Hide Range/.NET/Hide Range/Hide Range/Program.cs b/Format rows and columns/Hide Range/.NET/Hide Range/Hide Range/Program.cs index cf1043b5..0a5b6cba 100644 --- a/Format rows and columns/Hide Range/.NET/Hide Range/Hide Range/Program.cs +++ b/Format rows and columns/Hide Range/.NET/Hide Range/Hide Range/Program.cs @@ -35,12 +35,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/HideRange.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/HideRange.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } } } diff --git a/Format rows and columns/Hide Rows and Columns/.NET/Hide Rows and Columns/Hide Rows and Columns/Program.cs b/Format rows and columns/Hide Rows and Columns/.NET/Hide Rows and Columns/Hide Rows and Columns/Program.cs index 2f3f5f66..e3957268 100644 --- a/Format rows and columns/Hide Rows and Columns/.NET/Hide Rows and Columns/Hide Rows and Columns/Program.cs +++ b/Format rows and columns/Hide Rows and Columns/.NET/Hide Rows and Columns/Hide Rows and Columns/Program.cs @@ -11,8 +11,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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Hide Row and Column @@ -23,13 +22,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/HideRowsandColumns.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/HideRowsandColumns.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Format rows and columns/Insert Rows and Columns/.NET/Insert Rows and Columns/Insert Rows and Columns/Program.cs b/Format rows and columns/Insert Rows and Columns/.NET/Insert Rows and Columns/Insert Rows and Columns/Program.cs index 7b40201c..39324e72 100644 --- a/Format rows and columns/Insert Rows and Columns/.NET/Insert Rows and Columns/Insert Rows and Columns/Program.cs +++ b/Format rows and columns/Insert Rows and Columns/.NET/Insert Rows and Columns/Insert Rows and Columns/Program.cs @@ -11,8 +11,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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Insert Rows @@ -33,13 +32,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/InsertRowsandColumns.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/InsertRowsandColumns.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Format rows and columns/Move Rows and Columns/.NET/Move Rows and Columns/Move Rows and Columns/Program.cs b/Format rows and columns/Move Rows and Columns/.NET/Move Rows and Columns/Move Rows and Columns/Program.cs index 29e3a829..4ca2f503 100644 --- a/Format rows and columns/Move Rows and Columns/.NET/Move Rows and Columns/Move Rows and Columns/Program.cs +++ b/Format rows and columns/Move Rows and Columns/.NET/Move Rows and Columns/Move Rows and Columns/Program.cs @@ -11,10 +11,9 @@ 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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; - + #region Move Rows //Shifts cells toward Up after deletion worksheet.Range["A4:A8"].Clear(ExcelMoveDirection.MoveUp); @@ -27,13 +26,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/MoveRowsandColumns.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/MoveRowsandColumns.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Format rows and columns/Resize Rows and Columns/.NET/Resize Rows and Columns/Resize Rows and Columns/Program.cs b/Format rows and columns/Resize Rows and Columns/.NET/Resize Rows and Columns/Resize Rows and Columns/Program.cs index cf8efcd1..d4a1f74b 100644 --- a/Format rows and columns/Resize Rows and Columns/.NET/Resize Rows and Columns/Resize Rows and Columns/Program.cs +++ b/Format rows and columns/Resize Rows and Columns/.NET/Resize Rows and Columns/Resize Rows and Columns/Program.cs @@ -11,14 +11,13 @@ 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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Resize rows //Modifying the row height of one row worksheet.SetRowHeight(2, 100); - + //Modifying the row height of multiple rows worksheet.Range["A5:A10"].RowHeight = 40; #endregion @@ -33,13 +32,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ResizeRowsandColumns.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ResizeRowsandColumns.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Format rows and columns/Ungroup Rows and Columns/.NET/Ungroup Rows and Columns/Ungroup Rows and Columns/Program.cs b/Format rows and columns/Ungroup Rows and Columns/.NET/Ungroup Rows and Columns/Ungroup Rows and Columns/Program.cs index ee7f819a..a27f39ff 100644 --- a/Format rows and columns/Ungroup Rows and Columns/.NET/Ungroup Rows and Columns/Ungroup Rows and Columns/Program.cs +++ b/Format rows and columns/Ungroup Rows and Columns/.NET/Ungroup Rows and Columns/Ungroup Rows and Columns/Program.cs @@ -11,8 +11,7 @@ static void Main(string[] args) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; - FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate - ToUngroup.xlsx"), FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate - ToUngroup.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; #region Un-Group Rows @@ -27,13 +26,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/UngroupRowsandColumns.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/UngroupRowsandColumns.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); } } } diff --git a/Import and Export Data/Array to Worksheet/.NET/Array to Worksheet/Array to Worksheet/Program.cs b/Import and Export Data/Array to Worksheet/.NET/Array to Worksheet/Array to Worksheet/Program.cs index d215aed2..92277a91 100644 --- a/Import and Export Data/Array to Worksheet/.NET/Array to Worksheet/Array to Worksheet/Program.cs +++ b/Import and Export Data/Array to Worksheet/.NET/Array to Worksheet/Array to Worksheet/Program.cs @@ -21,12 +21,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ArrayToWorksheet.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ArrayToWorksheet.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } } } diff --git a/Import and Export Data/CollectionObjects to Worksheet/.NET/CollectionObjects to Worksheet/CollectionObjects to Worksheet/Program.cs b/Import and Export Data/CollectionObjects to Worksheet/.NET/CollectionObjects to Worksheet/CollectionObjects to Worksheet/Program.cs index f281bd5a..ee4c80b2 100644 --- a/Import and Export Data/CollectionObjects to Worksheet/.NET/CollectionObjects to Worksheet/CollectionObjects to Worksheet/Program.cs +++ b/Import and Export Data/CollectionObjects to Worksheet/.NET/CollectionObjects to Worksheet/CollectionObjects to Worksheet/Program.cs @@ -24,12 +24,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ImportCollectionObjects.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ImportCollectionObjects.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } } //Gets a list of sales reports diff --git a/Import and Export Data/DataColumn to Worksheet/.NET/DataColumn to Worksheet/DataColumn to Worksheet/Program.cs b/Import and Export Data/DataColumn to Worksheet/.NET/DataColumn to Worksheet/DataColumn to Worksheet/Program.cs index f5a4456b..4c5ddfd9 100644 --- a/Import and Export Data/DataColumn to Worksheet/.NET/DataColumn to Worksheet/DataColumn to Worksheet/Program.cs +++ b/Import and Export Data/DataColumn to Worksheet/.NET/DataColumn to Worksheet/DataColumn to Worksheet/Program.cs @@ -26,12 +26,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ImportDataColumn.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ImportDataColumn.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } } private static DataTable SampleDataTable() diff --git a/Import and Export Data/DataTable to Worksheet/.NET/DataTable to Worksheet/DataTable to Worksheet/Program.cs b/Import and Export Data/DataTable to Worksheet/.NET/DataTable to Worksheet/DataTable to Worksheet/Program.cs index 4b60422d..5dde6628 100644 --- a/Import and Export Data/DataTable to Worksheet/.NET/DataTable to Worksheet/DataTable to Worksheet/Program.cs +++ b/Import and Export Data/DataTable to Worksheet/.NET/DataTable to Worksheet/DataTable to Worksheet/Program.cs @@ -25,12 +25,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(); } } private static DataTable SampleDataTable() diff --git a/Import and Export Data/DataView to Worksheet/.NET/DataView to Worksheet/DataView to Worksheet/Program.cs b/Import and Export Data/DataView to Worksheet/.NET/DataView to Worksheet/DataView to Worksheet/Program.cs index efdaadc6..a3318053 100644 --- a/Import and Export Data/DataView to Worksheet/.NET/DataView to Worksheet/DataView to Worksheet/Program.cs +++ b/Import and Export Data/DataView to Worksheet/.NET/DataView to Worksheet/DataView to Worksheet/Program.cs @@ -26,12 +26,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ImportDataView.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ImportDataView.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } } private static DataTable SampleDataTable() diff --git a/Import and Export Data/Grouping Options/.NET/Grouping Options/Grouping Options/Program.cs b/Import and Export Data/Grouping Options/.NET/Grouping Options/Grouping Options/Program.cs index ed590d0b..15e7fa9b 100644 --- a/Import and Export Data/Grouping Options/.NET/Grouping Options/Grouping Options/Program.cs +++ b/Import and Export Data/Grouping Options/.NET/Grouping Options/Grouping Options/Program.cs @@ -52,12 +52,8 @@ private static void ImportData() #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ImportData.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ImportData.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } //Helper method to load data from XML file and add them in collections. private static IList GetVehicleDetails() @@ -65,8 +61,7 @@ private static IList GetVehicleDetails() XmlSerializer deserializer = new XmlSerializer(typeof(BrandObjects)); //Read data from XML file. - FileStream stream = new FileStream(Path.GetFullPath(@"Data/ExportData.xml"), FileMode.Open, FileAccess.Read); - TextReader textReader = new StreamReader(stream); + TextReader textReader = new StreamReader(Path.GetFullPath(@"Data/ExportData.xml")); BrandObjects brands = (BrandObjects)deserializer.Deserialize(textReader); //Initialize parent collection to add data from XML file. diff --git a/Import and Export Data/HTML Table to Worksheet/.NET/HTML Table to Worksheet/HTML Table to Worksheet/Program.cs b/Import and Export Data/HTML Table to Worksheet/.NET/HTML Table to Worksheet/HTML Table to Worksheet/Program.cs index fec38944..85a519ad 100644 --- a/Import and Export Data/HTML Table to Worksheet/.NET/HTML Table to Worksheet/HTML Table to Worksheet/Program.cs +++ b/Import and Export Data/HTML Table to Worksheet/.NET/HTML Table to Worksheet/HTML Table to Worksheet/Program.cs @@ -20,12 +20,10 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/HTMLTabletoWorksheet.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/HTMLTabletoWorksheet.xlsx")); #endregion //Dispose streams - outputStream.Dispose(); inputStream.Dispose(); } } diff --git a/Import and Export Data/Import Data Options/.NET/Import Data Options/Import Data Options/Program.cs b/Import and Export Data/Import Data Options/.NET/Import Data Options/Import Data Options/Program.cs index 9f482f04..de284a13 100644 --- a/Import and Export Data/Import Data Options/.NET/Import Data Options/Import Data Options/Program.cs +++ b/Import and Export Data/Import Data Options/.NET/Import Data Options/Import Data Options/Program.cs @@ -28,12 +28,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ImportDataOptions.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ImportDataOptions.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } } //Gets a list of sales reports diff --git a/Import and Export Data/Import with Hyperlink/.NET/Import with Hyperlink/Import with Hyperlink/Program.cs b/Import and Export Data/Import with Hyperlink/.NET/Import with Hyperlink/Import with Hyperlink/Program.cs index 2875dfc9..e52d367f 100644 --- a/Import and Export Data/Import with Hyperlink/.NET/Import with Hyperlink/Import with Hyperlink/Program.cs +++ b/Import and Export Data/Import with Hyperlink/.NET/Import with Hyperlink/Import with Hyperlink/Program.cs @@ -21,12 +21,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ImportData.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ImportData.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } } //Gets a list of company details diff --git a/Import and Export Data/Layout Options/.NET/Layout Options/Layout Options/Program.cs b/Import and Export Data/Layout Options/.NET/Layout Options/Layout Options/Program.cs index 39170a49..52423040 100644 --- a/Import and Export Data/Layout Options/.NET/Layout Options/Layout Options/Program.cs +++ b/Import and Export Data/Layout Options/.NET/Layout Options/Layout Options/Program.cs @@ -45,12 +45,8 @@ private static void ImportData() #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ImportData.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ImportData.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } //Helper method to load data from XML file and add them in collections. private static IList GetVehicleDetails() @@ -58,8 +54,7 @@ private static IList GetVehicleDetails() XmlSerializer deserializer = new XmlSerializer(typeof(BrandObjects)); //Read data from XML file. - FileStream stream = new FileStream(Path.GetFullPath(@"Data/ExportData.xml"), FileMode.Open, FileAccess.Read); - TextReader textReader = new StreamReader(stream); + TextReader textReader = new StreamReader(Path.GetFullPath(@"Data/ExportData.xml")); BrandObjects brands = (BrandObjects)deserializer.Deserialize(textReader); //Initialize parent collection to add data from XML file. diff --git a/Import and Export Data/Worksheet to CollectionObjects/.NET/Worksheet to CollectionObjects/Worksheet to CollectionObjects/Program.cs b/Import and Export Data/Worksheet to CollectionObjects/.NET/Worksheet to CollectionObjects/Worksheet to CollectionObjects/Program.cs index 23dd75d2..e9ca25c7 100644 --- a/Import and Export Data/Worksheet to CollectionObjects/.NET/Worksheet to CollectionObjects/Worksheet to CollectionObjects/Program.cs +++ b/Import and Export Data/Worksheet to CollectionObjects/.NET/Worksheet to CollectionObjects/Worksheet to CollectionObjects/Program.cs @@ -13,15 +13,11 @@ 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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; //Export worksheet data into Collection Objects List collectionObjects = worksheet.ExportData(1, 1, 10, 3); - - //Dispose streams - inputStream.Dispose(); } } public class Report diff --git a/Import and Export Data/Worksheet to DataTable/.NET/Worksheet to DataTable/Worksheet to DataTable/Program.cs b/Import and Export Data/Worksheet to DataTable/.NET/Worksheet to DataTable/Worksheet to DataTable/Program.cs index 85a6397e..f594489f 100644 --- a/Import and Export Data/Worksheet to DataTable/.NET/Worksheet to DataTable/Worksheet to DataTable/Program.cs +++ b/Import and Export Data/Worksheet to DataTable/.NET/Worksheet to DataTable/Worksheet to DataTable/Program.cs @@ -12,15 +12,11 @@ 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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; //Read data from the worksheet and Export to the DataTable DataTable customersTable = worksheet.ExportDataTable(worksheet.UsedRange, ExcelExportDataTableOptions.ColumnNames | ExcelExportDataTableOptions.ComputedFormulaValues); - - //Dispose streams - inputStream.Dispose(); } } } diff --git a/Import and Export Data/Worksheet to Nested Class/.NET/Worksheet to Nested Class/Worksheet to Nested Class/Program.cs b/Import and Export Data/Worksheet to Nested Class/.NET/Worksheet to Nested Class/Worksheet to Nested Class/Program.cs index 34ee5668..aa835f3e 100644 --- a/Import and Export Data/Worksheet to Nested Class/.NET/Worksheet to Nested Class/Worksheet to Nested Class/Program.cs +++ b/Import and Export Data/Worksheet to Nested Class/.NET/Worksheet to Nested Class/Worksheet to Nested Class/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); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; //Map column headers in worksheet with class properties. @@ -26,9 +25,6 @@ static void Main(string[] args) //Export worksheet data into nested class Objects. List nestedClassObjects = worksheet.ExportData(1, 1, 10, 5, mappingProperties); - - //Dispose streams - inputStream.Dispose(); } } }