diff --git a/Pictures in Excel/Add Picture/.NET/Add Picture/Add Picture/Program.cs b/Pictures in Excel/Add Picture/.NET/Add Picture/Add Picture/Program.cs index b3d7552f..e52a9a09 100644 --- a/Pictures in Excel/Add Picture/.NET/Add Picture/Add Picture/Program.cs +++ b/Pictures in Excel/Add Picture/.NET/Add Picture/Add Picture/Program.cs @@ -20,12 +20,10 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/AddPicture.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/AddPicture.xlsx")); #endregion //Dispose streams - outputStream.Dispose(); imageStream.Dispose(); } } diff --git a/Pictures in Excel/Add SVG Picture/.NET/Add SVG Picture/Add SVG Picture/Program.cs b/Pictures in Excel/Add SVG Picture/.NET/Add SVG Picture/Add SVG Picture/Program.cs index 80cab786..599db30b 100644 --- a/Pictures in Excel/Add SVG Picture/.NET/Add SVG Picture/Add SVG Picture/Program.cs +++ b/Pictures in Excel/Add SVG Picture/.NET/Add SVG Picture/Add SVG Picture/Program.cs @@ -22,12 +22,10 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/SVGImage.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/SVGImage.xlsx")); #endregion //Dispose streams - outputStream.Dispose(); svgStream.Dispose(); pngStream.Dispose(); } diff --git a/Pictures in Excel/External Image/.NET/External Image/External Image/Program.cs b/Pictures in Excel/External Image/.NET/External Image/External Image/Program.cs index 10c4df16..faacf514 100644 --- a/Pictures in Excel/External Image/.NET/External Image/External Image/Program.cs +++ b/Pictures in Excel/External Image/.NET/External Image/External Image/Program.cs @@ -19,12 +19,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ExternalImage.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ExternalImage.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } } } diff --git a/Pictures in Excel/ImageInMergedRegion/.NET/ImageInMergedRegion/ImageInMergedRegion/Program.cs b/Pictures in Excel/ImageInMergedRegion/.NET/ImageInMergedRegion/ImageInMergedRegion/Program.cs index 6423e596..80c9fc24 100644 --- a/Pictures in Excel/ImageInMergedRegion/.NET/ImageInMergedRegion/ImageInMergedRegion/Program.cs +++ b/Pictures in Excel/ImageInMergedRegion/.NET/ImageInMergedRegion/ImageInMergedRegion/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]; //Get the merged cells @@ -42,14 +41,8 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ImageInMergedRegion.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ImageInMergedRegion.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); - } } } diff --git a/Pictures in Excel/Move and Size with cells/.NET/Move and Size with cells/Move and Size with cells/Program.cs b/Pictures in Excel/Move and Size with cells/.NET/Move and Size with cells/Move and Size with cells/Program.cs index 31a7d711..5e0d3223 100644 --- a/Pictures in Excel/Move and Size with cells/.NET/Move and Size with cells/Move and Size with cells/Program.cs +++ b/Pictures in Excel/Move and Size with cells/.NET/Move and Size with cells/Move and Size with cells/Program.cs @@ -28,13 +28,11 @@ public static void Main(string[] args) //Hide the column worksheet.HideColumn(5); - //Saving the workbook as stream - FileStream OutputStream = new FileStream(Path.GetFullPath(@"Output/Output.xlsx"), FileMode.Create, FileAccess.ReadWrite); - workbook.SaveAs(OutputStream); + //Saving the workbook + workbook.SaveAs(Path.GetFullPath(@"Output/Output.xlsx")); //Dispose streams imageStream.Dispose(); - OutputStream.Dispose(); } } } diff --git a/Pictures in Excel/Position and Resize Picture/.NET/Position and Resize Picture/Position and Resize Picture/Program.cs b/Pictures in Excel/Position and Resize Picture/.NET/Position and Resize Picture/Position and Resize Picture/Program.cs index db35f6e9..cb5ed6c3 100644 --- a/Pictures in Excel/Position and Resize Picture/.NET/Position and Resize Picture/Position and Resize Picture/Program.cs +++ b/Pictures in Excel/Position and Resize Picture/.NET/Position and Resize Picture/Position and Resize Picture/Program.cs @@ -28,12 +28,10 @@ static void Main(string[] args) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ResizePicture.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ResizePicture.xlsx")); #endregion //Dispose streams - outputStream.Dispose(); imageStream.Dispose(); } }