Skip to content

Commit b25bf2f

Browse files
1003858: Reorganized open-save and added cloud storage
1 parent 19e5e5e commit b25bf2f

12 files changed

Lines changed: 24 additions & 1070 deletions

Document-Processing/Excel/Spreadsheet/React/Cloud-Storage/Open-from-Cloud/aws-s3-bucket.md

Lines changed: 1 addition & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -173,157 +173,4 @@ const openFromS3 = () => {
173173

174174
```
175175

176-
N> The **AWSSDK.S3** NuGet package must be installed in your application to use the previous code example.
177-
178-
# Save spreadsheet to AWS S3
179-
180-
To save a file to the AWS S3, you can follow the steps below
181-
182-
**Step 1:** Create a Simple Spreadsheet Sample in React
183-
184-
Start by following the steps provided in this [link](../../React//getting-started.md) to create a simple Spreadsheet sample in React. This will give you a basic setup of the Spreadsheet component.
185-
186-
**Step 2:** Modify the `SpreadsheetController.cs` File in the Web Service Project
187-
188-
1. Create a web service project in .NET Core 3.0 or above. You can refer to this [link](../../../Spreadsheet/React/open-save.md) for instructions on how to create a web service project.
189-
190-
2. Open the `SpreadsheetController.cs` file in your web service project.
191-
192-
3. Import the required namespaces at the top of the file:
193-
194-
```csharp
195-
196-
using Amazon;
197-
using Amazon.Runtime;
198-
using Amazon.S3;
199-
using Amazon.S3.Model;
200-
using Amazon.S3.Transfer;
201-
202-
```
203-
204-
4. Add the following private fields and constructor parameters to the `SpreadsheetController` class, In the constructor, assign the values from the configuration to the corresponding fields.
205-
206-
```csharp
207-
208-
private IConfiguration _configuration;
209-
public readonly string _accessKey;
210-
public readonly string _secretKey;
211-
public readonly string _bucketName;
212-
213-
public SpreadsheetController(IWebHostEnvironment hostingEnvironment, IMemoryCache cache, IConfiguration configuration)
214-
{
215-
_hostingEnvironment = hostingEnvironment;
216-
_cache = cache;
217-
_configuration = configuration;
218-
_accessKey = _configuration.GetValue<string>("AccessKey");
219-
_secretKey = _configuration.GetValue<string>("SecretKey");
220-
_bucketName = _configuration.GetValue<string>("BucketName");
221-
}
222-
223-
```
224-
225-
5. Create the `SaveToS3()` method to open the document from the AWS S3 bucket.
226-
227-
```csharp
228-
229-
[HttpPost]
230-
[Route("SaveToS3")]
231-
public async Task<IActionResult> SaveToS3([FromForm] SaveSettings saveSettings)
232-
{
233-
try
234-
{
235-
// Convert spreadsheet JSON to Excel file stream
236-
Stream fileStream = Workbook.Save<Stream>(saveSettings);
237-
fileStream.Position = 0; // Reset stream for upload
238-
239-
// Set AWS region and credentials
240-
var region = RegionEndpoint.USEast1;
241-
var config = new AmazonS3Config { RegionEndpoint = region };
242-
var credentials = new BasicAWSCredentials("your-access-key", "your-secretkey");
243-
244-
// Define S3 bucket and file name
245-
string bucketName = "your-bucket-name";
246-
string fileName = saveSettings.FileName + "." + saveSettings.SaveType.ToString().ToLower();
247-
248-
// Initialize S3 client
249-
using (var client = new AmazonS3Client(credentials, config))
250-
{
251-
// Use TransferUtility to upload the file stream
252-
var fileTransferUtility = new TransferUtility(client);
253-
await fileTransferUtility.UploadAsync(fileStream, bucketName, fileName);
254-
}
255-
256-
// Return success message
257-
return Ok("Excel file successfully saved to AWS S3.");
258-
}
259-
catch (Exception ex)
260-
{
261-
}
262-
}
263-
264-
```
265-
266-
6. Open the `appsettings.json` file in your web service project, Add the following lines below the existing `"AllowedHosts"` configuration.
267-
268-
```json
269-
270-
{
271-
"Logging": {
272-
"LogLevel": {
273-
"Default": "Information",
274-
"Microsoft.AspNetCore": "Warning"
275-
}
276-
},
277-
"AllowedHosts": "*",
278-
"AccessKey": "Your Access Key from AWS S3",
279-
"SecretKey": "Your Secret Key from AWS S3",
280-
"BucketName": "Your Bucket name from AWS S3"
281-
}
282-
283-
```
284-
285-
N> Replace **Your Access Key from AWS S3**, **Your Secret Key from AWS S3**, and **Your Bucket name from AWS S3** with your actual AWS access key, secret key and bucket name.
286-
287-
**Step 3:** Modify the index File in the Spreadsheet sample to using [`saveAsJson`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/#saveasjson) method to serialize the spreadsheet and send it to the backend.
288-
289-
```tsx
290-
291-
// Function to save the current spreadsheet to AWS S3 via an API call
292-
const saveToS3 = () => {
293-
// Convert the current spreadsheet to JSON format
294-
spreadsheet.saveAsJson().then((json) => {
295-
const formData = new FormData();
296-
297-
// Append necessary data to the form for the API request
298-
formData.append('FileName', loadedFileInfo.fileName); // Name of the file to save
299-
formData.append('saveType', loadedFileInfo.saveType); // Save type
300-
formData.append('JSONData', JSON.stringify(json.jsonObject.Workbook)); // Spreadsheet data
301-
formData.append(
302-
'PdfLayoutSettings',
303-
JSON.stringify({ FitSheetOnOnePage: false }) // PDF layout settings
304-
);
305-
306-
// Make a POST request to the backend API to save the file to S3. Replace the URL with your local or hosted endpoint URL.
307-
fetch('https://localhost:portNumber/api/spreadsheet/SaveToS3', {
308-
method: 'POST',
309-
body: formData,
310-
})
311-
.then((response) => {
312-
// Check if the response is successful
313-
if (!response.ok) {
314-
throw new Error(
315-
`Save request failed with status ${response.status}`
316-
);
317-
}
318-
window.alert('Workbook saved successfully.');
319-
})
320-
.catch((error) => {
321-
// Log any errors that occur during the save operation
322-
window.alert('Error saving to server:', error);
323-
});
324-
});
325-
};
326-
327-
```
328-
329-
N> The **AWSSDK.S3** NuGet package must be installed in your application to use the previous code example.
176+
N> The **AWSSDK.S3** NuGet package must be installed in your application to use the previous code example.

Document-Processing/Excel/Spreadsheet/React/Cloud-Storage/Open-from-Cloud/azure-blob-storage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: post
3-
title: Opening excel from Azure Blob Storage in React Spreadsheet control | Syncfusion
3+
title: Open excel from Azure Blob in React Spreadsheet control | Syncfusion
44
description: Learn about how to Open an Excel file from Azure Blob Storage in React Spreadsheet control of Syncfusion Essential JS 2.
55
platform: document-processing
66
control: Open file from Azure Blob Storage

Document-Processing/Excel/Spreadsheet/React/Cloud-Storage/Open-from-Cloud/google-cloud-storage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: post
3-
title: Opening excel from Google Cloud Storage in React Spreadsheet control | Syncfusion
3+
title: Open excel from Google Cloud in React Spreadsheet control | Syncfusion
44
description: Learn about how to Open an Excel file from Google Cloud Storage in React Spreadsheet control of Syncfusion Essential JS 2.
55
platform: document-processing
66
control: Open file from Google Cloud Storage

Document-Processing/Excel/Spreadsheet/React/Cloud-Storage/Save-to-Cloud/aws-s3-bucket.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public async Task<IActionResult> SaveToS3([FromForm] SaveSettings saveSettings)
116116

117117
N> Replace **Your Access Key from AWS S3**, **Your Secret Key from AWS S3**, and **Your Bucket name from AWS S3** with your actual AWS access key, secret key and bucket name
118118

119-
**Step 3:** Modify the index File in the Spreadsheet sample to using [`saveAsJson`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/#saveasjson) method to serialize the spreadsheet and send it to the backend
119+
**Step 3:** Modify the index File in the Spreadsheet sample to using [`saveAsJson`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#saveasjson) method to serialize the spreadsheet and send it to the back-end
120120

121121
```tsx
122122

Document-Processing/Excel/Spreadsheet/React/Cloud-Storage/Save-to-Cloud/azure-blob-storage.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: post
3-
title: Saving excel to Azure Blob Storage in React Spreadsheet control | Syncfusion
3+
title: Save excel to Azure Blob in React Spreadsheet control | Syncfusion
44
description: Learn about how to Save an Excel file from Azure Blob Storage in React Spreadsheet control of Syncfusion Essential JS 2.
55
platform: document-processing
66
control: Save file to Azure Blob Storage
@@ -90,8 +90,7 @@ public async Task<IActionResult> SaveToAzure([FromForm] SaveSettings saveSetting
9090

9191
N> Note: Install the Azure.Storage.Blobs NuGet package in the service project. Ensure the configured connection string has permissions to read and write blobs in the specified container.
9292

93-
**Step 3:** Modify the index File in the Spreadsheet sample to using [`saveAsJson`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/#saveasjson) method to serialize the spreadsheet and send it to the backend
94-
93+
**Step 3:** Modify the index File in the Spreadsheet sample to using [`saveAsJson`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#saveasjson) method to serialize the spreadsheet and send it to the back-end
9594

9695
```typescript
9796

Document-Processing/Excel/Spreadsheet/React/Cloud-Storage/Save-to-Cloud/google-cloud-storage.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public async Task<IActionResult> SaveToGoogleCloud([FromForm] SaveSettings saveS
8383

8484
```
8585

86-
**Step 3:** Modify the index File in the Spreadsheet sample to using [`saveAsJson`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/#saveasjson) method to serialize the spreadsheet and send it to the backend
86+
**Step 3:** Modify the index File in the Spreadsheet sample to using [`saveAsJson`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#saveasjson) method to serialize the spreadsheet and send it to the back-end
8787

8888
```csharp
8989

@@ -118,4 +118,4 @@ const saveToGoogleCloud = () => {
118118

119119
```
120120

121-
N> Note: The backend requires the Google.Cloud.Storage.V1 NuGet package and a service-account key that has Storage Object Admin (or equivalent) permissions on the target bucket.
121+
N> Note: The back-end requires the Google.Cloud.Storage.V1 NuGet package and a service-account key that has Storage Object Admin (or equivalent) permissions on the target bucket.

Document-Processing/Excel/Spreadsheet/React/Open/open.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public IActionResult Open(IFormCollection openRequest)
133133

134134
When opening large Excel files with many features and data, the server response can become very large. This might cause memory issues or connection problems during data transmission. The `Chunk Response Processing` feature solves this by dividing the server response into smaller parts, called chunks, and sending them to the client in parallel. The client receives these chunks and combines them to load the Excel data smoothly into the spreadsheet.
135135

136-
You can enable this feature by setting the [`chunkSize`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/opensettings#chunksize) property in the [`openSettings`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/#opensettings) object. Set the [`chunkSize`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/openSettings/#chunksize) to a value greater than 0 (in bytes). The [`chunkSize`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/opensettings#chunksize) defines how large each chunk will be. Make sure your server supports chunked responses to use this feature effectively.
136+
You can enable this feature by setting the [`chunkSize`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/opensettings#chunksize) property in the [`openSettings`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#opensettings) object. Set the [`chunkSize`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/openSettings/#chunksize) to a value greater than 0 (in bytes). The [`chunkSize`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/opensettings#chunksize) defines how large each chunk will be. Make sure your server supports chunked responses to use this feature effectively.
137137

138138
> This feature reduces memory usage on both the server and client, ensuring that resources are managed efficiently during data transmission. By sending smaller parts of data, it prevents connection issues that could occur with large payloads, making the transmission process more reliable. Additionally, it allows large Excel files to be loaded smoothly into the spreadsheet, providing a seamless user experience even with extensive data.
139139

Document-Processing/Excel/Spreadsheet/React/Save/save.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Please find the below table for the beforeSave event arguments.
5353
5454
### Configure JSON serialization options
5555

56-
Previously, when saving the Spreadsheet as a workbook JSON object using the [saveAsJson](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/#saveasjson) method, the entire workbook with all loaded features were processed and saved as a JSON object.
56+
Previously, when saving the Spreadsheet as a workbook JSON object using the [saveAsJson](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#saveasjson) method, the entire workbook with all loaded features were processed and saved as a JSON object.
5757

5858
Now, you have the option to selectively ignore some features while saving the Spreadsheet as a JSON object by configuring serialization options and passing them as arguments to the `saveAsJson` method. This argument is optional, and if not configured, the entire workbook JSON object will be saved without ignoring any features.
5959

@@ -90,7 +90,7 @@ The following code snippet demonstrates how to configure the serialization optio
9090

9191
### Send and receive custom params from client to server
9292

93-
Passing the custom parameters from client to server by using [`beforeSave`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/#beforesave) event.
93+
Passing the custom parameters from client to server by using [`beforeSave`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#beforesave) event.
9494

9595
{% tabs %}
9696
{% highlight js tabtitle="app.jsx" %}
@@ -121,7 +121,7 @@ Server side code snippets:
121121

122122
### Add custom header during save
123123

124-
You can add your own custom header to the save action in the Spreadsheet. For processing the data, it has to be sent from client to server side and adding customer header can provide privacy to the data with the help of Authorization Token. Through the [`fileMenuItemSelect`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/#filemenuitemselect) event, the custom header can be added to the request during save action.
124+
You can add your own custom header to the save action in the Spreadsheet. For processing the data, it has to be sent from client to server side and adding customer header can provide privacy to the data with the help of Authorization Token. Through the [`fileMenuItemSelect`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#filemenuitemselect) event, the custom header can be added to the request during save action.
125125

126126
{% tabs %}
127127
{% highlight js tabtitle="app.jsx" %}
@@ -142,7 +142,7 @@ You can add your own custom header to the save action in the Spreadsheet. For pr
142142

143143
### Change the PDF orientation
144144

145-
By default, the PDF document is created in **Portrait** orientation. You can change the orientation of the PDF document by using the `args.pdfLayoutSettings.orientation` argument settings in the [`beforeSave`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/#beforesave) event.
145+
By default, the PDF document is created in **Portrait** orientation. You can change the orientation of the PDF document by using the `args.pdfLayoutSettings.orientation` argument settings in the [`beforeSave`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#beforesave) event.
146146

147147
The possible values are:
148148

@@ -178,7 +178,7 @@ The following list of Excel file formats are supported in Spreadsheet:
178178

179179
### Methods
180180

181-
To save the Spreadsheet document as an `xlsx, xls, csv, or pdf` file, by using [save](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/#save) method should be called with the `url`, `fileName` and `saveType` as parameters. The following code example shows to save the spreadsheet file as an `xlsx, xls, csv, or pdf` in the button click event.
181+
To save the Spreadsheet document as an `xlsx, xls, csv, or pdf` file, by using [save](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#save) method should be called with the `url`, `fileName` and `saveType` as parameters. The following code example shows to save the spreadsheet file as an `xlsx, xls, csv, or pdf` in the button click event.
182182

183183
{% tabs %}
184184
{% highlight js tabtitle="app.jsx" %}

Document-Processing/Excel/Spreadsheet/React/Server-Deployment/docker-deployment.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ documentation: ug
1111

1212
The [**Syncfusion<sup style="font-size:70%">&reg;</sup> Spreadsheet (also known as Excel Viewer)**](https://www.syncfusion.com/spreadsheet-editor-sdk/react-spreadsheet-editor) is a feature-rich control for organizing and analyzing data in a tabular format. It provides all the common Excel features, including data binding, selection, editing, formatting, resizing, sorting, filtering, importing, and exporting Excel documents.
1313

14-
This Docker image is the pre-defined Docker container for Syncfusion's Spreadsheet backend functionalities. This server-side Web API project targets ASP.NET Core 8.0.
14+
This Docker image is the pre-defined Docker container for Syncfusion's Spreadsheet back-end functionalities. This server-side Web API project targets ASP.NET Core 8.0.
1515

1616
You can deploy it quickly to your infrastructure. If you want to add new functionality or customize any existing functionalities, create your own Docker file by referencing the existing [Spreadsheet Docker project](https://github.com/SyncfusionExamples/Spreadsheet-Server-Docker).
1717

@@ -57,7 +57,7 @@ docker-compose up
5757

5858
Now the Spreadsheet server Docker instance runs on localhost with the provided port number `http://localhost:6002`. Open this link in a browser and navigate to the Spreadsheet Web API open and save service at `http://localhost:6002/api/spreadsheet/open` and `http://localhost:6002/api/spreadsheet/save`.
5959

60-
**Step 4:** Append the URLs of the Docker instance running services to the [`openUrl`](https://helpej2.syncfusion.com/react/documentation/api/spreadsheet/#openurl) property as `http://localhost:6002/api/spreadsheet/open` and the [`saveUrl`](https://helpej2.syncfusion.com/react/documentation/api/spreadsheet/#saveurl) property as `http://localhost:6002/api/spreadsheet/save` in the client-side Spreadsheet component. For more information on how to get started with the Spreadsheet component, refer to this [`getting started page.`](https://help.syncfusion.com/document-processing/excel/spreadsheet/react/getting-started)
60+
**Step 4:** Append the URLs of the Docker instance running services to the [`openUrl`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#openurl) property as `http://localhost:6002/api/spreadsheet/open` and the [`saveUrl`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#saveurl) property as `http://localhost:6002/api/spreadsheet/save` in the client-side Spreadsheet component. For more information on how to get started with the Spreadsheet component, refer to this [`getting started page.`](https://help.syncfusion.com/document-processing/excel/spreadsheet/react/getting-started)
6161

6262
```js
6363
import * as React from 'react';

Document-Processing/Excel/Spreadsheet/React/Server-Deployment/how-to-deploy-spreadsheet-server-to-azure-app-service-using-azure-cli.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
layout: post
3-
title: Publish Spreadsheet Server to Azure App Service using Azure CLI
3+
title: Deploy Spreadsheet Server to Azure App Service using CLI | Syncfusion
44
description: Learn how to deploy the Syncfusion Spreadsheet Server Docker image to Azure App Service using Azure CLI.
55
control: How to deploy Spreadsheet Server Docker Image to Azure App Service using Azure CLI
66
platform: document-processing
77
documentation: ug
88
---
99

10-
# Publish Spreadsheet Server Docker Image to Azure App Service using Azure CLI in React Spreadsheet Editor component
10+
# Deploy Spreadsheet Server Docker Image to Azure App Service via CLI
1111

1212
## Prerequisites
1313

0 commit comments

Comments
 (0)