Skip to content

Commit 772f84c

Browse files
authored
Merge pull request #1759 from syncfusion-content/988874-ModifyStreams
990212-ModifyStreams-Loading and Saving Workbook
2 parents 44b5d18 + 8160c1d commit 772f84c

11 files changed

+40
-75
lines changed

Document-Processing/Excel/Excel-Library/NET/Loading-and-Saving-Workbook.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,8 @@ ExcelEngine excelEngine = new ExcelEngine();
7878
//Initialize IApplication
7979
IApplication application = excelEngine.Excel;
8080

81-
//Load the file into stream
82-
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
83-
8481
//Loads or open an existing workbook through Open method of IWorkbooks
85-
IWorkbook workbook = application.Workbooks.Open(inputStream);
82+
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
8683

8784
//To-Do some manipulation
8885
//To-Do some manipulation
Loading
Loading
Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
22
title: Loading and saving workbook in ASP.NET Core | Syncfusion
3-
description: Explains how to load and save Excel files in ASP.NET Core applications using Syncfusion XlsIO.
3+
description: Explains how to load and save Excel files in ASP.NET Core applications using Syncfusion Excel(XlsIO) library.
44
platform: document-processing
55
control: XlsIO
66
documentation: UG
77
---
88
# Loading and saving workbook in ASP.NET Core
99

10-
## Opening an existing workbook from stream
10+
## Opening an existing workbook
1111

12-
You can open an existing workbook from stream by using the overloads of [Open](https://help.syncfusion.com/cr/file-formats/Syncfusion.XlsIO.IWorkbooks.html#Syncfusion_XlsIO_IWorkbooks_Open_System_IO_Stream_) methods of [IWorkbooks](https://help.syncfusion.com/cr/file-formats/Syncfusion.XlsIO.IWorkbooks.html) interface.
12+
You can open an existing workbook by using the overloads of [Open](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorkbooks.html#Syncfusion_XlsIO_IWorkbooks_Open_System_String_) methods of [IWorkbooks](https://help.syncfusion.com/cr/file-formats/Syncfusion.XlsIO.IWorkbooks.html) interface.
1313

1414
{% tabs %}
1515
{% highlight c# tabtitle="C# [Cross-platform]" %}
@@ -19,17 +19,14 @@ ExcelEngine excelEngine = new ExcelEngine();
1919
//Initialize IApplication
2020
IApplication application = excelEngine.Excel;
2121

22-
//Load the file into stream
23-
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
24-
2522
//Loads or open an existing workbook through Open method of IWorkbooks
26-
IWorkbook workbook = application.Workbooks.Open(inputStream);
23+
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
2724
{% endhighlight %}
2825
{% endtabs %}
2926

30-
## Saving an Excel workbook to stream
27+
## Saving an Excel workbook
3128

32-
You can also save the created or manipulated workbook to stream using overloads of [SaveAs](https://help.syncfusion.com/cr/file-formats/Syncfusion.XlsIO.IWorkbook.html#Syncfusion_XlsIO_IWorkbook_SaveAs_System_IO_Stream_) methods.
29+
You can also save the created or manipulated workbook using overloads of [SaveAs](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorkbook.html#Syncfusion_XlsIO_IWorkbook_SaveAs_System_String_) methods.
3330

3431
{% tabs %}
3532
{% highlight c# tabtitle="C# [Cross-platform]" %}
@@ -39,20 +36,16 @@ ExcelEngine excelEngine = new ExcelEngine();
3936
//Initialize IApplication
4037
IApplication application = excelEngine.Excel;
4138

42-
//Load the file into stream
43-
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
44-
4539
//Loads or open an existing workbook through Open method of IWorkbooks
46-
IWorkbook workbook = application.Workbooks.Open(inputStream);
40+
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
4741

4842
//To-Do some manipulation
4943
//To-Do some manipulation
5044

5145
//Set the version of the workbook
5246
workbook.Version = ExcelVersion.Xlsx;
5347

54-
//Saving the workbook as stream
55-
FileStream outputStream = new FileStream("Output.xlsx", FileMode.Create, FileAccess.ReadWrite);
56-
workbook.SaveAs(outputStream);
48+
//Saving the workbook
49+
workbook.SaveAs("Output.xlsx");
5750
{% endhighlight %}
5851
{% endtabs %}

Document-Processing/Excel/Excel-Library/NET/Loading-and-Saving/loading-and-saving-excel-files-in-azure-app-service-windows.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
8484
application.DefaultVersion = ExcelVersion.Xlsx;
8585

8686
//Load an existing Excel document
87-
FileStream inputStream = new FileStream("Data/InputTemplate.xlsx", FileMode.Open, FileAccess.Read);
88-
IWorkbook workbook = application.Workbooks.Open(inputStream);
87+
IWorkbook workbook = application.Workbooks.Open("Data/InputTemplate.xlsx");
8988

9089
//Access first worksheet from the workbook.
9190
IWorksheet worksheet = workbook.Worksheets[0];

Document-Processing/Excel/Excel-Library/NET/Loading-and-Saving/loading-and-saving-excel-files-in-azure-functions-v1.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Loading and Saving Excel in Azure Functions v1 | Syncfusion
3-
description: Explains how to load and save an Excel files in Azure Functions v1 using Syncfusion Excel library.
3+
description: Explains how to load and save an Excel files in Azure Functions v1 using Syncfusion Excel(XlsIO) library.
44
platform: document-processing
55
control: XlsIO
66
documentation: UG
@@ -49,8 +49,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
4949
application.DefaultVersion = ExcelVersion.Xlsx;
5050

5151
//Load an existing Excel document
52-
FileStream inputStream = new FileStream("Data/InputTemplate.xlsx", FileMode.Open, FileAccess.Read);
53-
IWorkbook workbook = application.Workbooks.Open(inputStream);
52+
IWorkbook workbook = application.Workbooks.Open("Data/InputTemplate.xlsx");
5453

5554
//Access first worksheet from the workbook
5655
IWorksheet worksheet = workbook.Worksheets[0];

Document-Processing/Excel/Excel-Library/NET/Loading-and-Saving/loading-and-saving-excel-files-in-azure-functions-v4.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Loading and Saving Excel in Azure Functions v4 | Syncfusion
3-
description: Explains how to load and save an Excel files in Azure Functions v4 using Syncfusion Excel library.
3+
description: Explains how to load and save an Excel files in Azure Functions v4 using Syncfusion Excel(XlsIO) library.
44
platform: document-processing
55
control: XlsIO
66
documentation: UG
@@ -49,8 +49,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
4949
application.DefaultVersion = ExcelVersion.Xlsx;
5050

5151
//Load an existing Excel document
52-
FileStream inputStream = new FileStream("Data/InputTemplate.xlsx", FileMode.Open, FileAccess.Read);
53-
IWorkbook workbook = application.Workbooks.Open(inputStream);
52+
IWorkbook workbook = application.Workbooks.Open("Data/InputTemplate.xlsx");
5453

5554
//Access first worksheet from the workbook
5655
IWorksheet worksheet = workbook.Worksheets[0];

Document-Processing/Excel/Excel-Library/NET/Loading-and-Saving/loading-and-saving-excel-files-in-blazor-c-sharp.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
22
title: Loading and saving workbook in Blazor | Syncfusion
3-
description: Explains how to load and save Excel files in Blazor applications using Syncfusion XlsIO.
3+
description: Explains how to load and save Excel files in Blazor applications using Syncfusion Excel(XlsIO) library.
44
platform: document-processing
55
control: XlsIO
66
documentation: UG
77
---
88
# Loading and saving workbook in Blazor
99

10-
## Opening an existing workbook from Stream
10+
## Opening an existing workbook
1111

12-
You can open an existing workbook from stream by using the overloads of [Open](https://help.syncfusion.com/cr/file-formats/Syncfusion.XlsIO.IWorkbooks.html#Syncfusion_XlsIO_IWorkbooks_Open_System_IO_Stream_) methods of [IWorkbooks](https://help.syncfusion.com/cr/file-formats/Syncfusion.XlsIO.IWorkbooks.html) interface.
12+
You can open an existing workbook by using the overloads of [Open](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorkbooks.html#Syncfusion_XlsIO_IWorkbooks_Open_System_String_) methods of [IWorkbooks](https://help.syncfusion.com/cr/file-formats/Syncfusion.XlsIO.IWorkbooks.html) interface.
1313

1414
The code snippet for this process in Blazor Server-Side application is given below.
1515

@@ -21,11 +21,8 @@ ExcelEngine excelEngine = new ExcelEngine();
2121
//Initialize IApplication
2222
IApplication application = excelEngine.Excel;
2323

24-
//Load the file into stream
25-
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
26-
2724
//Loads or open an existing workbook through Open method of IWorkbooks
28-
IWorkbook workbook = application.Workbooks.Open(inputStream);
25+
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
2926
{% endhighlight %}
3027
{% endtabs %}
3128

@@ -61,11 +58,8 @@ ExcelEngine excelEngine = new ExcelEngine();
6158
//Initialize IApplication
6259
IApplication application = excelEngine.Excel;
6360

64-
//Load the file into stream
65-
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
66-
6761
//Loads or open an existing workbook through Open method of IWorkbooks
68-
IWorkbook workbook = application.Workbooks.Open(inputStream);
62+
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
6963

7064
//To-Do some manipulation
7165
//To-Do some manipulation

Document-Processing/Excel/Excel-Library/NET/Loading-and-Saving/loading-and-saving-excel-files-in-google-app-engine.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Loading and Saving Excel in GCP | Syncfusion
2+
title: Loading and Saving Excel in Google App Engine | Syncfusion
33
description: Explains how to load and save an Excel files in Google App Engine using .NET Core Excel (XlsIO) library without Microsoft Excel or interop dependencies.
44
platform: document-processing
55
control: XlsIO
@@ -90,8 +90,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
9090
application.DefaultVersion = ExcelVersion.Xlsx;
9191

9292
//Load an existing Excel document
93-
FileStream inputStream = new FileStream("Data/InputTemplate.xlsx", FileMode.Open, FileAccess.Read);
94-
IWorkbook workbook = application.Workbooks.Open(inputStream);
93+
IWorkbook workbook = application.Workbooks.Open("Data/InputTemplate.xlsx");
9594

9695
//Access first worksheet from the workbook.
9796
IWorksheet worksheet = workbook.Worksheets[0];
Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
22
title: Loading and saving workbook on Linux | Syncfusion
3-
description: Explains how to load and save Excel files on Linux applications using Syncfusion XlsIO.
3+
description: Explains how to load and save Excel files on Linux applications using Syncfusion Excel(XlsIO) library.
44
platform: document-processing
55
control: XlsIO
66
documentation: UG
77
---
88
# Loading and saving workbook on Linux
99

10-
## Opening an existing workbook from stream
10+
## Opening an existing workbook
1111

12-
You can open an existing workbook from stream by using the overloads of [Open](https://help.syncfusion.com/cr/file-formats/Syncfusion.XlsIO.IWorkbooks.html#Syncfusion_XlsIO_IWorkbooks_Open_System_IO_Stream_) methods of [IWorkbooks](https://help.syncfusion.com/cr/file-formats/Syncfusion.XlsIO.IWorkbooks.html) interface.
12+
You can open an existing workbook by using the overloads of [Open](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorkbooks.html#Syncfusion_XlsIO_IWorkbooks_Open_System_String_) methods of [IWorkbooks](https://help.syncfusion.com/cr/file-formats/Syncfusion.XlsIO.IWorkbooks.html) interface.
1313

1414
{% tabs %}
1515
{% highlight c# tabtitle="C# [Cross-platform]" %}
@@ -19,15 +19,14 @@ ExcelEngine excelEngine = new ExcelEngine();
1919
//Initialize IApplication
2020
IApplication application = excelEngine.Excel;
2121

22-
//A existing workbook is opened.
23-
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
24-
IWorkbook workbook = application.Workbooks.Open(inputStream);
22+
//A existing workbook is opened.
23+
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
2524
{% endhighlight %}
2625
{% endtabs %}
2726

28-
## Saving an Excel workbook to stream
27+
## Saving an Excel workbook
2928

30-
You can also save the created or manipulated workbook to stream using overloads of [SaveAs](https://help.syncfusion.com/cr/file-formats/Syncfusion.XlsIO.IWorkbook.html#Syncfusion_XlsIO_IWorkbook_SaveAs_System_IO_Stream_) methods.
29+
You can also save the created or manipulated workbook using overloads of [SaveAs](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorkbook.html#Syncfusion_XlsIO_IWorkbook_SaveAs_System_String_) methods.
3130

3231
{% tabs %}
3332
{% highlight c# tabtitle="C# [Cross-platform]" %}
@@ -37,20 +36,16 @@ ExcelEngine excelEngine = new ExcelEngine();
3736
//Initialize IApplication
3837
IApplication application = excelEngine.Excel;
3938

40-
//A existing workbook is opened.
41-
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
42-
IWorkbook workbook = application.Workbooks.Open(inputStream);
39+
//A existing workbook is opened.
40+
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
4341

4442
//To-Do some manipulation
4543
//To-Do some manipulation
4644

4745
//Set the version of the workbook
4846
workbook.Version = ExcelVersion.Xlsx;
4947

50-
//Initialize stream
51-
FileStream outputStream = new FileStream("Output.xlsx", FileMode.Create);
52-
53-
//Save the workbook as stream
54-
workbook.SaveAs(outputStream);
48+
//Save the workbook
49+
workbook.SaveAs("Output.xlsx");
5550
{% endhighlight %}
5651
{% endtabs %}

0 commit comments

Comments
 (0)