diff --git a/Document-Processing/Excel/Excel-Library/NET/Working-with-Drawing-Objects.md b/Document-Processing/Excel/Excel-Library/NET/Working-with-Drawing-Objects.md index d208da861..d132ede8a 100644 --- a/Document-Processing/Excel/Excel-Library/NET/Working-with-Drawing-Objects.md +++ b/Document-Processing/Excel/Excel-Library/NET/Working-with-Drawing-Objects.md @@ -57,12 +57,8 @@ The following code example illustrates how to add and manipulate a text box cont #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/TextBox.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/TextBox.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -140,8 +136,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; - FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic); + IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic); IWorksheet worksheet = workbook.Worksheets[0]; //Read the text @@ -157,10 +152,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) ITextBoxShape textbox = worksheet.Charts[0].TextBoxes.AddTextBox(2, 2, 80, 300); textbox.Text = "Text Box in the chart"; - //Saving the workbook as stream - FileStream outputStream = new FileStream(Output.xlsx, FileMode.Create, FileAccess.ReadWrite); - workbook.SaveAs(outputStream); - stream.Dispose(); + //Saving the workbook + workbook.SaveAs("Output.xlsx"); } {% endhighlight %} @@ -248,12 +241,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/CheckBox.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/CheckBox.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -363,12 +352,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ComboBox.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ComboBox.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -497,12 +482,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/OptionButton.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/OptionButton.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -616,12 +597,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/Comment.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/Comment.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -724,12 +701,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) comment.Fill.ForeColorIndex = ExcelKnownColors.Red; comment.Fill.BackColorIndex = ExcelKnownColors.White; - //Saving the workbook as stream - FileStream outputStream = new FileStream(Path.GetFullPath("Output/Output.xlsx"), FileMode.Create, FileAccess.ReadWrite); - workbook.SaveAs(outputStream); - - //Dispose stream - outputStream.Dispose(); + //Saving the workbook + workbook.SaveAs(Path.GetFullPath("Output/Output.xlsx")); } {% endhighlight %} @@ -807,7 +780,7 @@ End Using {% endhighlight %} {% endtabs %} -A complete working example for formatting comments in C# is present on [this GitHub page](). +A complete working example for formatting comments in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Excel%20Shapes/Format%20Comment/.NET/Formatting%20Comment). ### Visibility @@ -837,12 +810,8 @@ Comments in an Excel document can be shown or hidden using [IsVisible](https://h #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ShowOrHideComment.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ShowOrHideComment.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -906,8 +875,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) { 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]; //Remove all the comments in worksheet @@ -915,12 +883,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/RemoveComments.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/RemoveComments.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -971,8 +935,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; - FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/CommentsTemplate.xlsx"), FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/CommentsTemplate.xlsx"), ExcelOpenType.Automatic); IWorksheet worksheet = workbook.Worksheets[0]; @@ -981,12 +944,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/AddComment.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/AddComment.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -1036,8 +995,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; - FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/CommentsTemplate.xlsx"), FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/CommentsTemplate.xlsx"), ExcelOpenType.Automatic); IWorksheet worksheet = workbook.Worksheets[0]; @@ -1049,12 +1007,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ReplyComment.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ReplyComment.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -1110,8 +1064,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; - FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/CommentsTemplate.xlsx"), FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/CommentsTemplate.xlsx"), ExcelOpenType.Automatic); IWorksheet worksheet = workbook.Worksheets[0]; @@ -1123,12 +1076,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/ResolveComment.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/ResolveComment.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -1183,8 +1132,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; - FileStream inputStream = new FileStream("CommentsTemplate.xlsx", FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic); + IWorkbook workbook = application.Workbooks.Open("CommentsTemplate.xlsx", ExcelOpenType.Automatic); IWorksheet worksheet = workbook.Worksheets[0]; //Get the collection of threaded comments in the worksheet @@ -1193,10 +1141,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Delete the threaded comment threadedComments[0].Delete(); - //Saving the workbook as stream - FileStream stream = new FileStream("Output.xlsx", FileMode.Create, FileAccess.ReadWrite); - workbook.SaveAs(stream); - stream.Dispose(); + //Saving the workbook + workbook.SaveAs("Output.xlsx"); } {% endhighlight %} @@ -1249,8 +1195,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; - FileStream inputStream = new FileStream("CommentsTemplate.xlsx", FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic); + IWorkbook workbook = application.Workbooks.Open("CommentsTemplate.xlsx", ExcelOpenType.Automatic); IWorksheet worksheet = workbook.Worksheets[0]; //Get the collection of threaded comments in the worksheet @@ -1259,10 +1204,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Clear all the threaded comments threadedComments.Clear(); - //Saving the workbook as stream - FileStream stream = new FileStream("Output.xlsx", FileMode.Create, FileAccess.ReadWrite); - workbook.SaveAs(stream); - stream.Dispose(); + //Saving the workbook + workbook.SaveAs("Output.xlsx"); } {% endhighlight %} @@ -1343,12 +1286,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/AutoShapes.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/AutoShapes.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -1433,8 +1372,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) { 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]; IShapes shapes = worksheet.Shapes; @@ -1457,12 +1395,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/GroupShapes.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/GroupShapes.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -1519,8 +1453,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) { 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]; IShapes shapes = worksheet.Shapes; @@ -1530,12 +1463,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/UngroupShapes.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/UngroupShapes.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -1588,8 +1517,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) 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]; IShapes shapes = worksheet.Shapes; @@ -1599,12 +1527,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/UngroupAllShapes.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/UngroupAllShapes.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -1679,10 +1603,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Add ole object IOleObject oleObject = worksheet.OleObjects.AddLink("../../Data/Document.docx", image); - //Saving the workbook as stream - FileStream stream = new FileStream("LinkedObjects.xlsx", FileMode.Create, FileAccess.ReadWrite); - workbook.SaveAs(stream); - stream.Dispose(); + //Saving the workbook + workbook.SaveAs("LinkedObjects.xlsx"); } {% endhighlight %} @@ -1743,10 +1665,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Add ole object IOleObject oleObject = worksheet.OleObjects.Add(inputStream, image, OleObjectType.PowerPointPresentation); - //Saving the workbook as stream - FileStream stream = new FileStream("EmbeddedObjects.xlsx", FileMode.Create, FileAccess.ReadWrite); - workbook.SaveAs(stream); - stream.Dispose(); + //Saving the workbook + workbook.SaveAs("EmbeddedObjects.xlsx"); } {% endhighlight %} @@ -1824,10 +1744,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) oleObject2 = worksheet.OleObjects[1]; oleObject2.Shape.Remove(); - //Saving the workbook as stream - FileStream stream = new FileStream("OleObjects.xlsx", FileMode.Create, FileAccess.ReadWrite); - workbook.SaveAs(stream); - stream.Dispose(); + //Saving the workbook + workbook.SaveAs("OleObjects.xlsx"); } {% endhighlight %} @@ -1921,8 +1839,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; - FileStream inputStream = new FileStream("Data/Input.xlsx", FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream); + IWorkbook workbook = application.Workbooks.Open("Data/Input.xlsx"); IWorksheet worksheet = workbook.Worksheets[0]; IShapes shapes = worksheet.Shapes; @@ -1936,11 +1853,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Set shape2 to be visible shape2.IsHidden = false; - //Saving the workbook as stream - FileStream outputStream = new FileStream("Output/Output.xlsx", FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); - outputStream.Dispose(); - inputStream.Dispose(); + //Saving the workbook + workbook.SaveAs("Output/Output.xlsx"); } {% endhighlight %} diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-add-chart-labels-to-scatter-points.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-add-chart-labels-to-scatter-points.md index f771c9231..8efb6ce4f 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-add-chart-labels-to-scatter-points.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-add-chart-labels-to-scatter-points.md @@ -15,8 +15,7 @@ The following code illustrates adding chart labels to the scatter points of the using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; - FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic); + IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic); IWorksheet worksheet = workbook.Worksheets[0]; //Get the chart from the charts collection @@ -30,9 +29,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Set the Value to the Data Labels through Data Points serieOne.DataPoints[0].DataLabels.IsValue = true; - - FileStream stream = new FileStream("ChartLabels.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(stream); + + workbook.SaveAs("ChartLabels.xlsx"); workbook.Close(); excelEngine.Dispose(); } diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-change-the-grid-line-color-of-the-excel-sheet.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-change-the-grid-line-color-of-the-excel-sheet.md index 573b907aa..f6949726f 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-change-the-grid-line-color-of-the-excel-sheet.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-change-the-grid-line-color-of-the-excel-sheet.md @@ -21,9 +21,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //To change the grid line color using ExcelKnownColors worksheet.GridLineColor = ExcelKnownColors.Blue; - - FileStream stream = new FileStream("GridLineColor.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(stream); + + workbook.SaveAs("GridLineColor.xlsx"); workbook.Close(); excelEngine.Dispose(); } diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-copy-a-range-from-one-workbook-to-another.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-copy-a-range-from-one-workbook-to-another.md index f6cf8bab4..b5d14f8b1 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-copy-a-range-from-one-workbook-to-another.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-copy-a-range-from-one-workbook-to-another.md @@ -18,10 +18,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Excel2013; - FileStream inputStream1 = new FileStream("SourceWorkbook.xlsx", FileMode.Open, FileAccess.Read); - IWorkbook sourceWorkbook = application.Workbooks.Open(inputStream1, ExcelOpenType.Automatic); - FileStream inputStream2 = new FileStream("DestinationWorkbook.xlsx", FileMode.Open, FileAccess.Read); - IWorkbook destinationWorkbook = application.Workbooks.Open(inputStream2, ExcelOpenType.Automatic); + IWorkbook sourceWorkbook = application.Workbooks.Open("SourceWorkbook.xlsx", ExcelOpenType.Automatic); + IWorkbook destinationWorkbook = application.Workbooks.Open("DestinationWorkbook.xlsx", ExcelOpenType.Automatic); //The first worksheet object in the worksheets collection in the Source Workbook is accessed. IWorksheet sourceWorksheet = sourceWorkbook.Worksheets[0]; @@ -36,8 +34,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Copying (90 rows) from Source to Destination worksheet. sourceRange.CopyTo(destinationRange); - FileStream stream = new FileStream("CopyingRange.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); - destinationWorkbook.SaveAs(stream); + destinationWorkbook.SaveAs("CopyingRange.xlsx"); destinationWorkbook.Close(); excelEngine.Dispose(); } diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-copy-paste-the-cell-values-that-contain-only-formula.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-copy-paste-the-cell-values-that-contain-only-formula.md index 2dbbb9b5d..354b65e9f 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-copy-paste-the-cell-values-that-contain-only-formula.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-copy-paste-the-cell-values-that-contain-only-formula.md @@ -26,9 +26,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Copy and paste the values using ExcelCopyRangeOption sourceRange.CopyTo(destinationRange, ExcelCopyRangeOptions.None); - - FileStream stream = new FileStream("Output.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(stream); + + workbook.SaveAs("Output.xlsx"); workbook.Close(); excelEngine.Dispose(); } diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-create-a-chart-with-a-discontinuous-range.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-create-a-chart-with-a-discontinuous-range.md index 91d8c5489..75af970b7 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-create-a-chart-with-a-discontinuous-range.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-create-a-chart-with-a-discontinuous-range.md @@ -74,9 +74,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) shape.TopRow = 10; shape.LeftColumn = 3; shape.RightColumn = 15; - - FileStream stream = new FileStream("DiscontinuousRange.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(stream); + + workbook.SaveAs("DiscontinuousRange.xlsx"); workbook.Close(); excelEngine.Dispose(); } diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-create-a-sparkline-from-a-named-range.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-create-a-sparkline-from-a-named-range.md index b387d5156..0fff7b14b 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-create-a-sparkline-from-a-named-range.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-create-a-sparkline-from-a-named-range.md @@ -46,9 +46,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Add a sparkline sparklines.Add(dataRange, referenceRange); - - FileStream stream = new FileStream("SparklineFromNamedRange.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(stream); + + workbook.SaveAs("SparklineFromNamedRange.xlsx"); workbook.Close(); excelEngine.Dispose(); } diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-define-discontinuous-ranges.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-define-discontinuous-ranges.md index 22ab29e22..2c8acc112 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-define-discontinuous-ranges.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-define-discontinuous-ranges.md @@ -27,8 +27,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) rangeCollection.Add(worksheet.Range["D10:D11"]); rangeCollection.Text = "Welcome"; - FileStream stream = new FileStream("DiscontinuousRange.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(stream); + workbook.SaveAs("DiscontinuousRange.xlsx"); workbook.Close(); excelEngine.Dispose(); } diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-format-text-within-a-cell.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-format-text-within-a-cell.md index acfca10dd..52b70f3ed 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-format-text-within-a-cell.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-format-text-within-a-cell.md @@ -37,9 +37,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) blueFont.Italic = true; blueFont.RGBColor = Color.Blue; richText.SetFont(4, 7, blueFont); - - FileStream stream = new FileStream("FormattingText.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(stream); + + workbook.SaveAs("FormattingText.xlsx"); workbook.Close(); excelEngine.Dispose(); } diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-hide-the-summary-rows-and-columns-using-xlsio.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-hide-the-summary-rows-and-columns-using-xlsio.md index 3de5eee25..3605efeb9 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-hide-the-summary-rows-and-columns-using-xlsio.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-hide-the-summary-rows-and-columns-using-xlsio.md @@ -15,8 +15,7 @@ You can hide the summary rows and columns by using the [IsSummaryRowBelow](https using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; - FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic); + IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic); IWorksheet worksheet = workbook.Worksheets[0]; //Hide the summary rows at the bottom @@ -25,8 +24,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Hide the summary columns to the right worksheet.PageSetup.IsSummaryColumnRight = false; - FileStream stream = new FileStream("SuppressRowsColumns.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(stream); + workbook.SaveAs("SuppressRowsColumns.xlsx"); workbook.Close(); excelEngine.Dispose(); } diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-ignore-the-green-error-marker-in-worksheets.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-ignore-the-green-error-marker-in-worksheets.md index 96ed39c57..1656472e9 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-ignore-the-green-error-marker-in-worksheets.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-ignore-the-green-error-marker-in-worksheets.md @@ -15,15 +15,13 @@ When there exists data that are of different formats, the error marker appears i using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; - FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic); + IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic); IWorksheet worksheet = workbook.Worksheets[0]; //Ignore Error Options worksheet.Range["B3"].IgnoreErrorOptions = ExcelIgnoreError.All; - FileStream stream = new FileStream("IgnoreGreenError.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(stream); + workbook.SaveAs("IgnoreGreenError.xlsx"); workbook.Close(); excelEngine.Dispose(); } diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-import-data-table-with-its-data-type-using-template-markers.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-import-data-table-with-its-data-type-using-template-markers.md index af506ce74..f5f5dab7d 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-import-data-table-with-its-data-type-using-template-markers.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-import-data-table-with-its-data-type-using-template-markers.md @@ -15,8 +15,7 @@ You can import data table with its data type using template markers by setting t using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; - FileStream inputStream = new FileStream("TemplateMarker_Formulas.xlsx", FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic); + IWorkbook workbook = application.Workbooks.Open("TemplateMarker_Formulas.xlsx", ExcelOpenType.Automatic); //Create Template Marker Processor ITemplateMarkersProcessor marker = workbook.CreateTemplateMarkersProcessor(); @@ -27,8 +26,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Process the markers in the template and fill the values as it is in the DataTable marker.ApplyMarkers(); - FileStream stream = new FileStream("TemplateMarkerFormulas.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(stream); + workbook.SaveAs("TemplateMarkerFormulas.xlsx"); workbook.Close(); excelEngine.Dispose(); diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-merge-excel-files-from-more-than-one-workbook-to-a-single-file.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-merge-excel-files-from-more-than-one-workbook-to-a-single-file.md index 4fc04be43..dc68a4466 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-merge-excel-files-from-more-than-one-workbook-to-a-single-file.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-merge-excel-files-from-more-than-one-workbook-to-a-single-file.md @@ -26,14 +26,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Enumerates all the workbook files from the data folder and clone and merge it into new workbook foreach (string file in files) { - //Loads a template document from data folder - FileStream inputStream = new FileStream(file, FileMode.Open, FileAccess.Read); - - //Opens the template workbook from stream - IWorkbook tempWorkbook = application.Workbooks.Open(inputStream); - - //Disposes the stream - inputStream.Dispose(); + IWorkbook tempWorkbook = application.Workbooks.Open(file); //Cloning all workbook's worksheets workbook.Worksheets.AddCopy(tempWorkbook.Worksheets); @@ -42,8 +35,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Removing the first empty worksheet workbook.Worksheets.Remove(0); - FileStream outputStream = new FileStream("MergingFiles.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(outputStream); + workbook.SaveAs("MergingFiles.xlsx"); workbook.Close(); excelEngine.Dispose(); } @@ -64,14 +56,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Enumerates all the workbook files from the data folder and clone and merge it into new workbook foreach (string file in files) { - //Loads the all template document from data folder - FileStream inputStream = new FileStream(file, FileMode.Open, FileAccess.Read); - - //Opens the template workbook from stream - IWorkbook tempWorkbook = application.Workbooks.Open(inputStream); - - //Disposes the stream - inputStream.Dispose(); + IWorkbook tempWorkbook = application.Workbooks.Open(file); //Cloning all workbook's worksheets workbook.Worksheets.AddCopy(tempWorkbook.Worksheets); diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-open-an-excel-2013-macro-enabled-template.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-open-an-excel-2013-macro-enabled-template.md index 761c54a8a..9a1fc09f8 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-open-an-excel-2013-macro-enabled-template.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-open-an-excel-2013-macro-enabled-template.md @@ -17,12 +17,10 @@ using (ExcelEngine excelEngine = new ExcelEngine()) IApplication application = excelEngine.Excel; //Open an existing XLTM file - FileStream inputStream = new FileStream("Sample.xltm", FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic); + IWorkbook workbook = application.Workbooks.Open("Sample.xltm", ExcelOpenType.Automatic); //Save the file as XLSM - FileStream outputStream = new FileStream("Output.xlsm", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(outputStream); + workbook.SaveAs("Output.xlsm"); workbook.Close(); excelEngine.Dispose(); } diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-open-an-excel-file-from-stream.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-open-an-excel-file-from-stream.md index b43899be4..b00c56b5b 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-open-an-excel-file-from-stream.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-open-an-excel-file-from-stream.md @@ -19,8 +19,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Opening a File from a Stream FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read); IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic); - FileStream stream = new FileStream("Output.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(stream); + workbook.SaveAs("Output.xlsx"); workbook.Close(); excelEngine.Dispose(); } diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-open-an-existing-xlsx-workbook-and-save-it-as-xls.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-open-an-existing-xlsx-workbook-and-save-it-as-xls.md index 1d2b04202..f05124792 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-open-an-existing-xlsx-workbook-and-save-it-as-xls.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-open-an-existing-xlsx-workbook-and-save-it-as-xls.md @@ -17,12 +17,10 @@ using (ExcelEngine excelEngine = new ExcelEngine()) IApplication application = excelEngine.Excel; //Open an existing Excel 2013 file - FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic); + IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic); //Save it as "Excel 97 to 2003" format - FileStream outputStream = new FileStream("Output.xls", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(outputStream); + workbook.SaveAs("Output.xls"); workbook.Close(); excelEngine.Dispose(); } diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-protect-certain-cells-in-a-worksheet.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-protect-certain-cells-in-a-worksheet.md index 009d46d4c..3731425ad 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-protect-certain-cells-in-a-worksheet.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-protect-certain-cells-in-a-worksheet.md @@ -19,8 +19,7 @@ The following code snippet illustrate this. using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; - FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic); + IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic); IWorksheet worksheet = workbook.Worksheets[0]; //Sample data @@ -31,8 +30,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) worksheet.Range["A1:A10"].Text = "UnLocked"; worksheet.Protect("syncfusion", ExcelSheetProtection.All); - FileStream stream = new FileStream("ProtectCells.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(stream); + workbook.SaveAs("ProtectCells.xlsx"); workbook.Close(); excelEngine.Dispose(); } diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-save-a-file-to-stream.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-save-a-file-to-stream.md index 87bba82e6..ce6c132ae 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-save-a-file-to-stream.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-save-a-file-to-stream.md @@ -15,8 +15,7 @@ XlsIO provides support to save a workbook to a .NET stream. The following code s using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; - FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic); + IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic); //Save the workbook to stream FileStream fileStream = new FileStream("Output.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-a-line-break-inside-a-cell.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-a-line-break-inside-a-cell.md index 7a30c3d19..33fc9b259 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-a-line-break-inside-a-cell.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-a-line-break-inside-a-cell.md @@ -22,9 +22,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Save the line break inside the cell worksheet.Range["A1"].CellStyle.WrapText = true; worksheet.Range["A1"].Text = String.Format("Hello\nworld"); - - FileStream stream = new FileStream("LineBreak.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(stream); + + workbook.SaveAs("LineBreak.xlsx"); workbook.Close(); excelEngine.Dispose(); } diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-or-format-a-header-footer.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-or-format-a-header-footer.md index 1df26518c..f64592d1f 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-or-format-a-header-footer.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-or-format-a-header-footer.md @@ -21,9 +21,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Format the header worksheet.PageSetup.CenterHeader = @"&""Gothic,bold""Center Header Text"; - - FileStream stream = new FileStream("HeaderFormat.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(stream); + + workbook.SaveAs("HeaderFormat.xlsx"); workbook.Close(); excelEngine.Dispose(); } diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-print-titles.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-print-titles.md index dd0d6566c..62604da2a 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-print-titles.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-set-print-titles.md @@ -17,15 +17,13 @@ XlsIO allows to designate row header to repeat on all pages of a printed workboo using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; - FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic); + IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic); IWorksheet worksheet = workbook.Worksheets[0]; //Print Rows 1 to 3 on every printed page worksheet.PageSetup.PrintTitleRows = "$A$1:$IV$3"; - - FileStream stream = new FileStream("TitleRows.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(stream); + + workbook.SaveAs("TitleRows.xlsx"); workbook.Close(); excelEngine.Dispose(); } @@ -68,15 +66,13 @@ XlsIO allows to designate column header to repeat on all pages of a printed work using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; - FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic); + IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic); IWorksheet worksheet = workbook.Worksheets[0]; //Print Columns 1 to 3 on every printed page worksheet.PageSetup.PrintTitleColumns = "$A$1:$C$65536"; - FileStream stream = new FileStream("TitleColumns.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(stream); + workbook.SaveAs("TitleColumns.xlsx"); workbook.Close(); excelEngine.Dispose(); } diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-sort-two-or-more-columns-in-a-pivot-table.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-sort-two-or-more-columns-in-a-pivot-table.md index cddf1f83e..278430026 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-sort-two-or-more-columns-in-a-pivot-table.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-sort-two-or-more-columns-in-a-pivot-table.md @@ -27,8 +27,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Pivot Top to Bottom sorting of values in 5th column (E) of the pivot table, (i.e.) 4th data column rowField.AutoSort(PivotFieldSortType.Ascending, 4); - FileStream stream = new FileStream("TopToBottomSort.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(stream); + workbook.SaveAs("TopToBottomSort.xlsx"); workbook.Close(); excelEngine.Dispose(); } diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-unfreeze-the-rows-and-columns-in-xlsio.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-unfreeze-the-rows-and-columns-in-xlsio.md index f107f6ebb..6afe647b4 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-unfreeze-the-rows-and-columns-in-xlsio.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-unfreeze-the-rows-and-columns-in-xlsio.md @@ -15,8 +15,7 @@ You can unfreeze rows and columns in XlsIO by using the [RemovePanes](https://he using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; - FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream, ExcelOpenType.Automatic); + IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic); IWorksheet worksheet = workbook.Worksheets[0]; //Freeze the panes @@ -25,8 +24,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Unfreeze the panes worksheet.RemovePanes(); - FileStream stream = new FileStream("Unfreeze.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(stream); + workbook.SaveAs("Unfreeze.xlsx"); workbook.Close(); excelEngine.Dispose(); } diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-use-named-ranges-with-xlsio.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-use-named-ranges-with-xlsio.md index 587f7245e..065528b2f 100644 --- a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-use-named-ranges-with-xlsio.md +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-use-named-ranges-with-xlsio.md @@ -39,8 +39,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) MessageBox.Show(name.Name.ToString()); } - FileStream stream = new FileStream("NamedRange.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite); - workbook.SaveAs(stream); + workbook.SaveAs("NamedRange.xlsx"); workbook.Close(); excelEngine.Dispose(); }