Skip to content

Commit f90d422

Browse files
committed
895338: Addressed review comments.
1 parent a7d2f91 commit f90d422

File tree

1 file changed

+12
-23
lines changed

1 file changed

+12
-23
lines changed

ej2-asp-core-mvc/spreadsheet/open-save.md

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -249,19 +249,18 @@ The following code example shows how to open the spreadsheet data as base64 stri
249249

250250
### To open an Excel file located on a server
251251

252-
By default, the Spreadsheet component provides an option to browse files from the local file system and open them within the component. If you want to load an Excel file located on a server, you need to configure the server endpoint to fetch the Excel file from the server location, process it using `Syncfusion.EJ2.Spreadsheet.AspNet.Core`, and send it back to the client as `JSON data`. On the client side, you should use the `openFromJson` method to load that `JSON data` into the Spreadsheet component.
252+
By default, the Spreadsheet control provides an option to browse files from the local file system and open them within the control. If you want to load an Excel file located on a server, you need to configure the server endpoint to fetch the Excel file from the server location, process it using `Syncfusion.EJ2.Spreadsheet.AspNet.Core`, and send it back to the client side as `JSON data`. On the client side, you should use the `openFromJson` method to load that `JSON data` into the Spreadsheet control.
253253

254-
**Server endpoint code**:
254+
**Server Endpoint**:
255255

256256
```csharp
257-
258257
public IActionResult Open([FromBody] FileOptions options)
259258
{
260259
OpenRequest open = new OpenRequest();
261260
string filePath = _env.ContentRootPath.ToString() + "\\Files\\" + options.FileName + ".xlsx";
262261
// Getting the file stream from the file path.
263262
FileStream fileStream = new FileStream(filePath, FileMode.Open);
264-
// Converting MemoryStream to IFormFile.
263+
// Converting "MemoryStream" to "IFormFile".
265264
IFormFile formFile = new FormFile(fileStream, 0, fileStream.Length, "", options.FileName + ".xlsx");
266265
open.File = formFile;
267266
// Processing the Excel file and return the workbook JSON.
@@ -276,11 +275,11 @@ By default, the Spreadsheet component provides an option to browse files from th
276275
}
277276
```
278277

279-
**Client-side code**:
278+
**Client Side**:
280279

281280
```js
282281

283-
// Fetch call to server to load the Excel.
282+
// Fetch call to server to load the Excel file.
284283
fetch('https://localhost:{{Your port number}}/Home/Open', {
285284
method: 'POST',
286285
headers: {
@@ -296,16 +295,11 @@ By default, the Spreadsheet component provides an option to browse files from th
296295

297296
```
298297

299-
You can find the server endpoint code to fetch and process the Excel file in this attachment(https://www.syncfusion.com/downloads/support/directtrac/general/ze/WebApplication1_(1)-880363187).
300-
301-
After launching the server endpoint, you need to update the file fetch URL on the client-side sample as shown below.
298+
You can find the server endpoint code to fetch and process the Excel file in this [attachment](https://www.syncfusion.com/downloads/support/directtrac/general/ze/WebApplication1_(1)-880363187). After launching the server endpoint, you need to update the URL on the client side sample as shown below.
302299

303300
```js
304-
305301
// To open an Excel file from the server.
306-
307302
fetch('https://localhost:{port number}/Home/Open')
308-
309303
```
310304

311305
### External workbook confirmation dialog
@@ -555,9 +549,9 @@ The following code example shows how to save the spreadsheet data as base64 stri
555549

556550
### To save an Excel file to a server location
557551

558-
By default, the spreadsheet saves the Excel file and downloads it to the local file system. If you want to save an Excel file to a server location, you need to configure the server endpoint to convert the spreadsheet data into a file stream and save it to the server location. On the client side, you must convert the spreadsheet data into `JSON` format using the `saveAsJson` method and send it to the server endpoint. On the server endpoint, you should convert the received spreadsheet `JSON` data into a file stream using `Syncfusion.EJ2.Spreadsheet.AspNet.Core`, convert the stream into an Excel file, and then save it to the server location.
552+
By default, the Spreadsheet control saves the Excel file and downloads it to the local file system. If you want to save an Excel file to a server location, you need to configure the server endpoint to convert the spreadsheet data into a file stream and save it to the server location. To do this, first, on the client side, you must convert the spreadsheet data into `JSON` format using the `saveAsJson` method and send it to the server endpoint. On the server endpoint, you should convert the received spreadsheet `JSON` data into a file stream using `Syncfusion.EJ2.Spreadsheet.AspNet.Core`, then convert the stream into an Excel file, and finally save it to the server location.
559553

560-
**Client-side code**:
554+
**Client Side**:
561555

562556
```js
563557

@@ -580,7 +574,7 @@ By default, the spreadsheet saves the Excel file and downloads it to the local f
580574

581575
```
582576

583-
**Server endpoint code**:
577+
**Server Endpoint**:
584578

585579
```csharp
586580

@@ -591,9 +585,9 @@ By default, the spreadsheet saves the Excel file and downloads it to the local f
591585
try
592586
{
593587

594-
// Save the workbook as Stream.
588+
// Save the workbook as stream.
595589
Stream fileStream = Workbook.Save<Stream>(saveSettings);
596-
// Using XLSIO, we are opening the file stream and saving the file in the server under Files folder.
590+
// Using XLSIO, we are opening the file stream and saving the file in the server under "Files" folder.
597591
// You can also save the stream file in your server location.
598592
IWorkbook workbook = application.Workbooks.Open(fileStream);
599593
string basePath = _env.ContentRootPath + "\\Files\\" + saveSettings.FileName + ".xlsx";
@@ -613,16 +607,11 @@ By default, the spreadsheet saves the Excel file and downloads it to the local f
613607

614608
```
615609

616-
You can find the server endpoint code to save the spreadsheet JSON data as an Excel file in the attached documentation(https://www.syncfusion.com/downloads/support/directtrac/general/ze/WebApplication1_(1)-880363187).
617-
618-
After launching the server endpoint, you need to update the file fetch URL on the client-side sample as shown below.
610+
You can find the server endpoint code to save the spreadsheet data as an Excel file in this [attachment](https://www.syncfusion.com/downloads/support/directtrac/general/ze/WebApplication1_(1)-880363187). After launching the server endpoint, you need to update the URL on the client side sample as shown below.
619611

620612
```js
621-
622613
//To save an Excel file to the server.
623-
624614
fetch('https://localhost:{port number}/Home/Save')
625-
626615
```
627616

628617
### Supported file formats

0 commit comments

Comments
 (0)