From 65b7b56a3bc7e2cc00d171c63a051898bfc7e289 Mon Sep 17 00:00:00 2001 From: Ramya Sivakumar Date: Fri, 24 Oct 2025 18:36:48 +0530 Subject: [PATCH] 988874-ModifyStreams --- .../Working-with-Cell-or-Range-Formatting.md | 82 ++++--------------- 1 file changed, 14 insertions(+), 68 deletions(-) diff --git a/Document-Processing/Excel/Excel-Library/NET/Working-with-Cell-or-Range-Formatting.md b/Document-Processing/Excel/Excel-Library/NET/Working-with-Cell-or-Range-Formatting.md index 6dff372a8..89a094af2 100644 --- a/Document-Processing/Excel/Excel-Library/NET/Working-with-Cell-or-Range-Formatting.md +++ b/Document-Processing/Excel/Excel-Library/NET/Working-with-Cell-or-Range-Formatting.md @@ -33,12 +33,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/CreateStyle.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/CreateStyle.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -110,12 +106,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/RowColumnStyle.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/RowColumnStyle.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -257,12 +249,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/GlobalStyle.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/GlobalStyle.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -687,12 +675,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/NumberFormat.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/NumberFormat.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -873,9 +857,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) string text = worksheet.Range["B4"].DisplayText; //Saving the workbook as stream - FileStream stream = new FileStream("Output.xlsx", FileMode.Create, FileAccess.ReadWrite); - workbook.SaveAs(stream); - stream.Dispose(); + workbook.SaveAs(Path.GetFullPath("Output/Output.xlsx")); } {% endhighlight %} @@ -970,12 +952,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/HideCellContent.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/HideCellContent.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -1189,12 +1167,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/Alignment.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/Alignment.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -1374,12 +1348,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/MergeandUnMerge.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/MergeandUnMerge.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -1445,12 +1415,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/WrapText.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/WrapText.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -1542,12 +1508,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/AutoFit.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/AutoFit.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -1643,12 +1605,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/FontSettings.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/FontSettings.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -1860,12 +1818,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/BorderSettings.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/BorderSettings.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -1996,12 +1950,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/HTMLString.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/HTMLString.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -2105,12 +2055,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/RichText.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/RichText.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %}