Skip to content

Commit fc9b923

Browse files
991684-GettingStartedUG
1 parent 6b74c3b commit fc9b923

11 files changed

+38
-86
lines changed

Document-Processing/Excel/Excel-Library/NET/Create-read-edit-excel-files-in-asp-net-core-c-sharp.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,8 +920,7 @@ IApplication application = excelEngine.Excel;
920920
application.DefaultVersion = ExcelVersion.Xlsx;
921921

922922
//A existing workbook is opened.
923-
FileStream sampleFile = new FileStream("Sample.xlsx", FileMode.Open);
924-
IWorkbook workbook = application.Workbooks.Open(sampleFile);
923+
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
925924

926925
//Access first worksheet from the workbook.
927926
IWorksheet worksheet = workbook.Worksheets[0];

Document-Processing/Excel/Excel-Library/NET/Create-read-edit-excel-files-in-blazor-c-sharp.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -730,8 +730,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
730730
application.DefaultVersion = ExcelVersion.Xlsx;
731731

732732
//Load the existing Excel workbook into IWorkbook
733-
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open);
734-
IWorkbook workbook = application.Workbooks.Open(inputStream);
733+
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
735734

736735
//Get the first worksheet in the workbook into IWorksheet
737736
IWorksheet worksheet = workbook.Worksheets[0];
@@ -2424,8 +2423,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
24242423
application.DefaultVersion = ExcelVersion.Xlsx;
24252424

24262425
//Load the existing Excel workbook into IWorkbook
2427-
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open);
2428-
IWorkbook workbook = application.Workbooks.Open(inputStream);
2426+
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
24292427

24302428
//Get the first worksheet in the workbook into IWorksheet
24312429
IWorksheet worksheet = workbook.Worksheets[0];
@@ -2448,4 +2446,4 @@ using (ExcelEngine excelEngine = new ExcelEngine())
24482446
{% endhighlight %}
24492447
{% endtabs %}
24502448

2451-
A complete working example of how to read and edit an Excel file in Blazor Server web application in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Getting%20Started/Blazor%20Web%20App/Server%20Side/Edit_Excel).
2449+
A complete working example of how to read and edit an Excel file in Blazor Server web application in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Getting%20Started/Blazor%20Web%20App/Server%20Side/Edit_Excel).

Document-Processing/Excel/Excel-Library/NET/create-excel-file-csharp-vbnet.md

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())
8686
//Adding text to a cell
8787
worksheet.Range["A1"].Text = "Hello World";
8888

89-
//Saving the workbook as stream
90-
FileStream stream = new FileStream("Sample.xlsx", FileMode.Create, FileAccess.ReadWrite);
91-
workbook.SaveAs(stream);
92-
93-
//Dispose stream
94-
stream.Dispose();
89+
//Saving the workbook
90+
workbook.SaveAs("Sample.xlsx");
9591
}
9692
{% endhighlight %}
9793

@@ -342,12 +338,8 @@ Finally, save the document in file system and close/dispose the instance of [IWo
342338

343339
{% tabs %}
344340
{% highlight c# tabtitle="C# [Cross-platform]" %}
345-
//Save the workbook as stream
346-
FileStream stream = new FileStream("Sample.xlsx", FileMode.Create, FileAccess.ReadWrite);
347-
workbook.SaveAs(stream);
348-
349-
//Disposing the stream
350-
stream.Dispose();
341+
//Save the workbook
342+
workbook.SaveAs("Sample.xlsx");
351343

352344
//Closing the workbook
353345
workbook.Close();
@@ -436,11 +428,7 @@ namespace ExcelCreation
436428
worksheet.Pictures.AddPicture(10, 2, imageStream);
437429

438430
//Saving the workbook to disk in XLSX format
439-
FileStream stream = new FileStream("Sample.xlsx", FileMode.Create, FileAccess.ReadWrite);
440-
workbook.SaveAs(stream);
441-
442-
//Dispose stream
443-
stream.Dispose();
431+
workbook.SaveAs("Sample.xlsx");
444432
}
445433
}
446434
}
@@ -595,10 +583,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())
595583
//Import data to worksheet
596584
worksheet.ImportData(employees, 2, 1, false);
597585

598-
//Saving the workbook as stream
599-
FileStream file = new FileStream("Sample.xlsx", FileMode.Create, FileAccess.ReadWrite);
600-
workbook.SaveAs(file);
601-
file.Dispose();
586+
//Saving the workbook
587+
workbook.SaveAs("Sample.xlsx");
602588
}
603589
{% endhighlight %}
604590

@@ -831,17 +817,14 @@ using (ExcelEngine excelEngine = new ExcelEngine())
831817
{
832818
IApplication application = excelEngine.Excel;
833819
application.DefaultVersion = ExcelVersion.Xlsx;
834-
FileStream inputStream = new FileStream("WorkbookWithData.xlsx", FileMode.Open, FileAccess.Read);
835-
IWorkbook workbook = application.Workbooks.Open(inputStream);
820+
IWorkbook workbook = application.Workbooks.Open("WorkbookWithData.xlsx");
836821
IWorksheet worksheet = workbook.Worksheets[0];
837822

838823
//Export data from worksheet used range to a DataTable
839824
DataTable customersTable = worksheet.ExportDataTable(worksheet.UsedRange, ExcelExportDataTableOptions.ColumnNames | ExcelExportDataTableOptions.DetectColumnTypes);
840825

841-
//Saving the workbook as stream
842-
FileStream file = new FileStream("Output.xlsx", FileMode.Create, FileAccess.ReadWrite);
843-
workbook.SaveAs(file);
844-
file.Dispose();
826+
//Saving the workbook
827+
workbook.SaveAs("Output.xlsx");
845828
}
846829
{% endhighlight %}
847830

@@ -1115,8 +1098,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
11151098
{
11161099
IApplication application = excelEngine.Excel;
11171100
application.DefaultVersion = ExcelVersion.Xlsx;
1118-
FileStream inputStream = new FileStream("TemplateMarker.xlsx", FileMode.Open, FileAccess.Read);
1119-
IWorkbook workbook = application.Workbooks.Open(inputStream);
1101+
IWorkbook workbook = application.Workbooks.Open("TemplateMarker.xlsx");
11201102

11211103
//Create template marker processor for the workbook
11221104
ITemplateMarkersProcessor marker = workbook.CreateTemplateMarkersProcessor();
@@ -1131,10 +1113,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())
11311113
//Applying Markers
11321114
marker.ApplyMarkers();
11331115

1134-
//Saving the workbook as stream
1135-
FileStream file = new FileStream("TemplateMarkerResult.xlsx", FileMode.Create, FileAccess.ReadWrite);
1136-
workbook.SaveAs(file);
1137-
file.Dispose();
1116+
//Saving the workbook
1117+
workbook.SaveAs("TemplateMarkerResult.xlsx");
11381118
}
11391119
{% endhighlight %}
11401120

Document-Processing/Excel/Excel-Library/NET/create-excel-files-in-console-apps-c-sharp.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())
224224
worksheet.Range["A9:A14"].RowHeight = 15;
225225
worksheet.Range["A15:A23"].RowHeight = 18;
226226

227-
//Saving the Excel to the Stream
228-
FileStream stream = new FileStream("CreateExcel.xlsx", FileMode.Create, FileAccess.Write);
229-
workbook.SaveAs(stream);
227+
//Saving the Excel
228+
workbook.SaveAs("CreateExcel.xlsx");
230229
}
231230
{% endhighlight %}
232231

@@ -633,9 +632,8 @@ using (ExcelEngine excelEngine = new ExcelEngine())
633632
worksheet.Range["A9:A14"].RowHeight = 15;
634633
worksheet.Range["A15:A23"].RowHeight = 18;
635634

636-
//Saving the Excel to the Stream
637-
FileStream stream = new FileStream("CreateExcel.xlsx", FileMode.Create, FileAccess.Write);
638-
workbook.SaveAs(stream);
635+
//Saving the Excel
636+
workbook.SaveAs("CreateExcel.xlsx");
639637
}
640638
{% endhighlight %}
641639

@@ -1647,4 +1645,4 @@ By executing the program, you will get the Excel file as below.
16471645

16481646
Click [here](https://www.syncfusion.com/document-processing/excel-framework/net) to explore the rich set of Syncfusion<sup>&reg;</sup> Excel library (XlsIO) features.
16491647

1650-
An online sample link to [create an Excel document](https://ej2.syncfusion.com/aspnetcore/Excel/Create#/material3) in ASP.NET Core.
1648+
An online sample link to [create an Excel document](https://ej2.syncfusion.com/aspnetcore/Excel/Create#/material3) in ASP.NET Core.

Document-Processing/Excel/Excel-Library/NET/create-read-edit-excel-files-in-aws-elastic-beanstalk.md

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

293293
//A existing workbook is opened.
294-
FileStream sampleFile = new FileStream("Data/InputTemplate.xlsx", FileMode.Open);
295-
IWorkbook workbook = application.Workbooks.Open(sampleFile);
294+
IWorkbook workbook = application.Workbooks.Open("Data/InputTemplate.xlsx");
296295

297296
//Access first worksheet from the workbook.
298297
IWorksheet worksheet = workbook.Worksheets[0];

Document-Processing/Excel/Excel-Library/NET/create-read-edit-excel-files-in-aws-lambda.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,7 @@ IApplication application = excelEngine.Excel;
341341
application.DefaultVersion = ExcelVersion.Xlsx;
342342

343343
//A existing workbook is opened.
344-
FileStream sampleFile = new FileStream("Sample.xlsx", FileMode.Open);
345-
IWorkbook workbook = application.Workbooks.Open(sampleFile);
344+
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
346345

347346
//Access first worksheet from the workbook.
348347
IWorksheet worksheet = workbook.Worksheets[0];
@@ -362,4 +361,4 @@ A complete working example of how to read and edit an Excel file in AWS Lambda i
362361

363362
Click [here](https://www.syncfusion.com/document-processing/excel-framework/net-core) to explore the rich set of Syncfusion<sup>&reg;</sup> Excel library (XlsIO) features.
364363

365-
An online sample link to [create an Excel document](https://ej2.syncfusion.com/aspnetcore/Excel/Create#/material3) in ASP.NET Core.
364+
An online sample link to [create an Excel document](https://ej2.syncfusion.com/aspnetcore/Excel/Create#/material3) in ASP.NET Core.

Document-Processing/Excel/Excel-Library/NET/create-read-edit-excel-files-in-azure-app-service-linux.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,7 @@ IApplication application = excelEngine.Excel;
510510
application.DefaultVersion = ExcelVersion.Xlsx;
511511

512512
//A existing workbook is opened.
513-
FileStream sampleFile = new FileStream("Sample.xlsx", FileMode.Open);
514-
IWorkbook workbook = application.Workbooks.Open(sampleFile);
513+
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
515514

516515
//Access first worksheet from the workbook.
517516
IWorksheet worksheet = workbook.Worksheets[0];

Document-Processing/Excel/Excel-Library/NET/create-read-edit-excel-files-in-azure-app-service-windows.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,7 @@ IApplication application = excelEngine.Excel;
510510
application.DefaultVersion = ExcelVersion.Xlsx;
511511

512512
//A existing workbook is opened.
513-
FileStream sampleFile = new FileStream("Sample.xlsx", FileMode.Open);
514-
IWorkbook workbook = application.Workbooks.Open(sampleFile);
513+
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
515514

516515
//Access first worksheet from the workbook.
517516
IWorksheet worksheet = workbook.Worksheets[0];

Document-Processing/Excel/Excel-Library/NET/create-read-edit-excel-files-in-google-app-engine.md

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

448448
//A existing workbook is opened.
449-
FileStream inputStream = new FileStream("InputTemplate.xlsx", FileMode.Open, FileAccess.Read);
450-
IWorkbook workbook = application.Workbooks.Open(inputStream);
449+
IWorkbook workbook = application.Workbooks.Open("InputTemplate.xlsx");
451450

452451
//Access first worksheet from the workbook.
453452
IWorksheet worksheet = workbook.Worksheets[0];

Document-Processing/Excel/Excel-Library/NET/create-read-edit-excel-files-in-linux-c-sharp.md

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,7 @@ using (ExcelEngine excelEngine = new ExcelEngine())
213213
worksheet.Range["A9:A14"].RowHeight = 15;
214214
worksheet.Range["A15:A23"].RowHeight = 18;
215215

216-
FileStream outputStream = new FileStream("Output.xlsx", FileMode.Create);
217-
workbook.SaveAs(outputStream);
218-
outputStream.Dispose();
216+
workbook.SaveAs("Output.xlsx");
219217
imageStream.Dispose();
220218
}
221219
{% endhighlight %}
@@ -254,8 +252,7 @@ IApplication application = excelEngine.Excel;
254252
application.DefaultVersion = ExcelVersion.Xlsx;
255253

256254
//A existing workbook is opened.
257-
FileStream inputStream = new FileStream("Sample.xlsx", FileMode.Open, FileAccess.Read);
258-
IWorkbook workbook = application.Workbooks.Open(inputStream);
255+
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
259256

260257
//Access first worksheet from the workbook.
261258
IWorksheet worksheet = workbook.Worksheets[0];
@@ -266,15 +263,8 @@ worksheet.Range["A3"].Text ="Hello World";
266263
//Access a cell value from Excel
267264
var value = worksheet.Range["A1"].Value;
268265

269-
//Initialize stream
270-
FileStream outputStream = new FileStream("Output.xlsx", FileMode.Create);
271-
272-
//Save the workbook as stream
273-
workbook.SaveAs(outputStream);
274-
275-
//Dispose the streams
276-
outputStream.Dispose();
277-
inputStream.Dispose();
266+
//Save the workbook
267+
workbook.SaveAs("Output.xlsx");
278268

279269
workbook.Close();
280270
excelEngine.Dispose();
@@ -283,4 +273,4 @@ excelEngine.Dispose();
283273

284274
Click [here](https://www.syncfusion.com/document-processing/excel-framework/net-core) to explore the rich set of Syncfusion<sup>&reg;</sup> Excel library (XlsIO) features.
285275

286-
An online sample link to [create an Excel document](https://ej2.syncfusion.com/aspnetcore/Excel/Create#/material3) in ASP.NET Core.
276+
An online sample link to [create an Excel document](https://ej2.syncfusion.com/aspnetcore/Excel/Create#/material3) in ASP.NET Core.

0 commit comments

Comments
 (0)