You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -115,6 +115,81 @@ You can achieve to access the remote excel file by using the [`created`](https:/
115
115
{% endtabs %}
116
116
{% endif %}
117
117
118
+
### Open an excel file from blob data
119
+
120
+
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 open an Excel file from blob data, you need to fetch the blob data from the server or another source and convert this blob data into a `File` object. Then, you can use the `open` method in the Spreadsheet control to load that `File` object.
121
+
122
+
Please find the code to fetch the blob data and load it into the Spreadsheet control below.
123
+
124
+
{% if page.publishingplatform == "aspnet-core" %}
125
+
126
+
{% tabs %}
127
+
{% highlight cshtml tabtitle="CSHTML" %}
128
+
{% include code-snippet/spreadsheet/open-from-blob/tagHelper %}
129
+
{% endhighlight %}
130
+
{% highlight c# tabtitle="OpenController.cs" %}
131
+
{% include code-snippet/spreadsheet/open-from-blob/opencontroller.cs %}
{% include code-snippet/spreadsheet/open-from-blob/razor %}
140
+
{% endhighlight %}
141
+
{% highlight c# tabtitle="OpenController.cs" %}
142
+
{% include code-snippet/spreadsheet/open-from-blob/opencontroller.cs %}
143
+
{% endhighlight %}
144
+
{% endtabs %}
145
+
{% endif %}
146
+
147
+
### Open an Excel file located on a server
148
+
149
+
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.
// Processing the Excel file and return the workbook JSON.
162
+
varresult=Workbook.Open(open);
163
+
fileStream.Close();
164
+
returnContent(result);
165
+
}
166
+
167
+
publicclassFileOptions
168
+
{
169
+
publicstringFileName { get; set; } =string.Empty;
170
+
}
171
+
```
172
+
173
+
```js
174
+
175
+
// Fetch call to server to load the Excel file.
176
+
fetch('Home/Open', {
177
+
method:'POST',
178
+
headers: {
179
+
'Content-Type':'application/json',
180
+
},
181
+
body:JSON.stringify({ FileName:'Sample' }),
182
+
})
183
+
.then((response) =>response.json())
184
+
.then((data) => {
185
+
// Load the JSON data into spreadsheet.
186
+
spreadsheet.openFromJson({ file: data });
187
+
})
188
+
189
+
```
190
+
191
+
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).
192
+
118
193
### Open an excel file using a hosted web service in AWS Lambda
119
194
120
195
Before proceeding with the opening process, you should deploy the spreadsheet open/save web API service in AWS Lambda. To host the open/save web service in the AWS Lambda environment, please refer to the following KB documentation.
@@ -367,82 +442,7 @@ You can add your own custom header to the open action in the Spreadsheet. For pr
367
442
{% include code-snippet/spreadsheet/open-header/opencontroller.cs %}
368
443
{% endhighlight %}
369
444
{% endtabs %}
370
-
{% endif %}
371
-
372
-
### To open an excel file from blob data
373
-
374
-
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 open an Excel file from blob data, you need to fetch the blob data from the server or another source and convert this blob data into a `File` object. Then, you can use the `open` method in the Spreadsheet control to load that `File` object.
375
-
376
-
Please find the code to fetch the blob data and load it into the Spreadsheet control below.
377
-
378
-
{% if page.publishingplatform == "aspnet-core" %}
379
-
380
-
{% tabs %}
381
-
{% highlight cshtml tabtitle="CSHTML" %}
382
-
{% include code-snippet/spreadsheet/open-from-blob/tagHelper %}
383
-
{% endhighlight %}
384
-
{% highlight c# tabtitle="OpenController.cs" %}
385
-
{% include code-snippet/spreadsheet/open-from-blob/opencontroller.cs %}
{% include code-snippet/spreadsheet/open-from-blob/razor %}
394
-
{% endhighlight %}
395
-
{% highlight c# tabtitle="OpenController.cs" %}
396
-
{% include code-snippet/spreadsheet/open-from-blob/opencontroller.cs %}
397
-
{% endhighlight %}
398
-
{% endtabs %}
399
-
{% endif %}
400
-
401
-
### To open an Excel file located on a server
402
-
403
-
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.
// Processing the Excel file and return the workbook JSON.
416
-
varresult=Workbook.Open(open);
417
-
fileStream.Close();
418
-
returnContent(result);
419
-
}
420
-
421
-
publicclassFileOptions
422
-
{
423
-
publicstringFileName { get; set; } =string.Empty;
424
-
}
425
-
```
426
-
427
-
```js
428
-
429
-
// Fetch call to server to load the Excel file.
430
-
fetch('Home/Open', {
431
-
method:'POST',
432
-
headers: {
433
-
'Content-Type':'application/json',
434
-
},
435
-
body:JSON.stringify({ FileName:'Sample' }),
436
-
})
437
-
.then((response) =>response.json())
438
-
.then((data) => {
439
-
// Load the JSON data into spreadsheet.
440
-
spreadsheet.openFromJson({ file: data });
441
-
})
442
-
443
-
```
444
-
445
-
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).
445
+
{% endif %}
446
446
447
447
### External workbook confirmation dialog
448
448
@@ -523,6 +523,93 @@ N> * Use `Ctrl + S` keyboard shortcut to save the Spreadsheet data as Excel file
523
523
<br/> * The default value of [allowSave](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.Spreadsheet.Spreadsheet.html#Syncfusion_EJ2_Spreadsheet_Spreadsheet_AllowSave) property is `true`. For demonstration purpose, we have showcased the [allowSave](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.Spreadsheet.Spreadsheet.html#Syncfusion_EJ2_Spreadsheet_Spreadsheet_AllowSave) property in previous code snippet.
524
524
<br/> * Demo purpose only, we have used the online web service url link.
525
525
526
+
### Save an excel file as blob data
527
+
528
+
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 as blob data, you need to set `needBlobData` property to **true** and `isFullPost` property to **false** in the `beforeSave` event of the spreadsheet. Subsequently, you will receive the spreadsheet data as a blob in the `saveComplete` event. You can then post the blob data to the server endpoint for saving.
529
+
530
+
Please find below the code to retrieve blob data from the Spreadsheet control below.
531
+
532
+
{% if page.publishingplatform == "aspnet-core" %}
533
+
534
+
{% tabs %}
535
+
{% highlight cshtml tabtitle="CSHTML" %}
536
+
{% include code-snippet/spreadsheet/save-as-blob/tagHelper %}
537
+
{% endhighlight %}
538
+
{% highlight c# tabtitle="SaveController.cs" %}
539
+
{% include code-snippet/spreadsheet/save-as-blob/savecontroller.cs %}
{% include code-snippet/spreadsheet/save-as-blob/razor %}
548
+
{% endhighlight %}
549
+
{% highlight c# tabtitle="SaveController.cs" %}
550
+
{% include code-snippet/spreadsheet/save-as-blob/savecontroller.cs %}
551
+
{% endhighlight %}
552
+
{% endtabs %}
553
+
{% endif %}
554
+
555
+
### Save an Excel file to a server
556
+
557
+
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.
558
+
559
+
```js
560
+
561
+
// Convert the spreadsheet workbook to JSON data.
562
+
spreadsheet.saveAsJson().then((json) => {
563
+
constformData=newFormData();
564
+
formData.append('FileName', "Sample");
565
+
formData.append('saveType', 'Xlsx');
566
+
// Passing the JSON data to perform the save operation.
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).
612
+
526
613
### Save an excel file using a hosted web service in AWS Lambda
527
614
528
615
Before proceeding with the save process, you should deploy the spreadsheet open/save web API service in AWS Lambda. To host the open/save web service in the AWS Lambda environment, please refer to the following KB documentation.
@@ -839,93 +926,6 @@ The possible values are:
839
926
{% endtabs %}
840
927
{% endif %}
841
928
842
-
### To save an excel file as blob data
843
-
844
-
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 as blob data, you need to set `needBlobData` property to **true** and `isFullPost` property to **false** in the `beforeSave` event of the spreadsheet. Subsequently, you will receive the spreadsheet data as a blob in the `saveComplete` event. You can then post the blob data to the server endpoint for saving.
845
-
846
-
Please find below the code to retrieve blob data from the Spreadsheet control below.
847
-
848
-
{% if page.publishingplatform == "aspnet-core" %}
849
-
850
-
{% tabs %}
851
-
{% highlight cshtml tabtitle="CSHTML" %}
852
-
{% include code-snippet/spreadsheet/save-as-blob/tagHelper %}
853
-
{% endhighlight %}
854
-
{% highlight c# tabtitle="SaveController.cs" %}
855
-
{% include code-snippet/spreadsheet/save-as-blob/savecontroller.cs %}
{% include code-snippet/spreadsheet/save-as-blob/razor %}
864
-
{% endhighlight %}
865
-
{% highlight c# tabtitle="SaveController.cs" %}
866
-
{% include code-snippet/spreadsheet/save-as-blob/savecontroller.cs %}
867
-
{% endhighlight %}
868
-
{% endtabs %}
869
-
{% endif %}
870
-
871
-
### To save an Excel file to a server location
872
-
873
-
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.
874
-
875
-
```js
876
-
877
-
// Convert the spreadsheet workbook to JSON data.
878
-
spreadsheet.saveAsJson().then((json) => {
879
-
constformData=newFormData();
880
-
formData.append('FileName', "Sample");
881
-
formData.append('saveType', 'Xlsx');
882
-
// Passing the JSON data to perform the save operation.
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).
928
-
929
929
### Supported file formats
930
930
931
931
The following list of Excel file formats are supported in Spreadsheet:
@@ -963,6 +963,7 @@ To save the Spreadsheet document as an `xlsx, xls, csv, or pdf` file, by using `
963
963
{% endif %}
964
964
965
965
966
+
966
967
## Server Configuration
967
968
968
969
In Spreadsheet component, import and export operation processed in `server-side`, to use importing and exporting in your projects, it is required to create a server with any of the following web services.
0 commit comments