From f90f32bb4cf423c12a5412380b25deacae3aa07c Mon Sep 17 00:00:00 2001 From: Krishna Kaviarasu Sethuramasamy Date: Thu, 6 Aug 2026 12:39:12 +0530 Subject: [PATCH 1/4] 1045866: update saving-documents (5 files) --- .../saving-documents/aws-s3-bucket.md | 28 +++++----- .../saving-documents/azure-blob-storage.md | 47 +++++++--------- .../box-cloud-file-storage.md | 34 +++++++----- .../dropbox-cloud-file-storage.md | 35 +++++++----- .../saving-documents/google-cloud-storage.md | 53 ++++++++++++------- 5 files changed, 111 insertions(+), 86 deletions(-) diff --git a/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/aws-s3-bucket.md b/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/aws-s3-bucket.md index 3ed27c5190..a3b45cd5c1 100644 --- a/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/aws-s3-bucket.md +++ b/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/aws-s3-bucket.md @@ -1,21 +1,21 @@ --- layout: post -title: Save document to AWS S3 in Document editor | Syncfusion -description: Learn about how to Save document to AWS S3 in ASP.NET Core Document editor of Syncfusion Essential JS 2 and more details. +title: Save document to AWS S3 in DOCX Editor | Syncfusion +description: Learn about how to Save document to AWS S3 in ASP.NET Core Document Editor of Syncfusion Essential JS 2 and more details. platform: document-processing control: Save document to AWS S3 documentation: ug domainurl: ##DomainURL## --- -# Save document to AWS S3 in Document editor Component +# Save document to AWS S3 in Document Editor Component -To save a document to AWS S3, you can follow the steps below +To save a document to AWS S3, follow these steps: **Step 1:** Create a Simple [ASP.NET Core DOCX Editor](https://www.syncfusion.com/docx-editor-sdk/asp-net-core-docx-editor) (Document Editor) Sample in ASP.NET Core -Start by following the steps provided in this [link](../../document-editor/getting-started-core) to create a simple Document Editor sample in ASP.NET Core. This will give you a basic setup of the Document Editor component. +Follow the steps in this [link](../../document-editor/getting-started-core) to create a simple Document Editor sample in ASP.NET Core. This will give you a basic setup of the Document Editor component. **Step 2:** Modify the `DocumentEditorController.cs` File in the Web Service Project @@ -25,15 +25,19 @@ Start by following the steps provided in this [link](../../document-editor/getti * Import the required namespaces at the top of the file: ```csharp +using Microsoft.AspNetCore.Cors; +using Microsoft.AspNetCore.Http; using System.IO; using Amazon; using Amazon.S3; using Amazon.S3.Model; ``` -* Add the following private fields and constructor parameters to the `DocumentEditorController` class, In the constructor, assign the values from the configuration to the corresponding fields +* Add the following private fields and a constructor to the `DocumentEditorController` class. In the constructor, assign the configuration values to the corresponding fields. ```csharp +private IWebHostEnvironment _hostingEnvironment; +private IMemoryCache _cache; private IConfiguration _configuration; public readonly string _accessKey; public readonly string _secretKey; @@ -50,7 +54,7 @@ public DocumentEditorController(IWebHostEnvironment hostingEnvironment, IMemoryC } ``` -* Create the `SaveToS3()` method to save the document to AWS S3 bucket +* Create the `SaveToS3()` method to save the document to the AWS S3 bucket ```csharp @@ -58,7 +62,7 @@ public DocumentEditorController(IWebHostEnvironment hostingEnvironment, IMemoryC [HttpPost] [EnableCors("AllowAllOrigins")] [Route("SaveToS3")] -//Post action for save the document to AWS S3 +//Post action for saving the document to AWS S3 public void SaveToS3(IFormCollection data) { @@ -97,7 +101,7 @@ private string GetValue(IFormCollection data, string key) } ``` -* Open the `appsettings.json` file in your web service project, Add the following lines below the existing `"AllowedHosts"` configuration +* Open the `appsettings.json` file in your web service project. Add the following lines below the existing `"AllowedHosts"` configuration ```json { @@ -114,11 +118,11 @@ private string GetValue(IFormCollection data, string key) } ``` -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 +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. **Step 3:** Modify the Index.cshtml File in the Document Editor sample -In the client-side, to export the document into blob the document using `saveAsBlob` and sent to server-side for saving in AWS S3 Bucket. +On the client side, export the document to a blob using `saveAsBlob` and send it to the server for saving in the AWS S3 bucket. {% tabs %} @@ -131,4 +135,4 @@ In the client-side, to export the document into blob the document using `saveAsB {% endtabs %} -N> The **AWSSDK.S3** NuGet package must be installed in your application to use the previous code example. +N> The **AWSSDK.S3** NuGet package must be installed in your application to use the code above. diff --git a/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/azure-blob-storage.md b/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/azure-blob-storage.md index c262ff4c4c..26bb266fae 100644 --- a/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/azure-blob-storage.md +++ b/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/azure-blob-storage.md @@ -1,21 +1,21 @@ --- layout: post -title: Save to Azure Blob in Document editor | Syncfusion -description: Learn about how to Save document to Azure Blob Storage in ASP.NET Core Document editor control of Syncfusion Essential JS 2 and more details. +title: Save to Azure Blob in DOCX Editor | Syncfusion +description: Learn about how to Save document to Azure Blob Storage in ASP.NET Core Document Editor component of Syncfusion Essential JS 2 and more details. platform: document-processing control: Save document to Azure Blob Storage documentation: ug domainurl: ##DomainURL## --- -# Save document to Azure Blob Storage in ASP.NET Core +# Save document to Azure Blob Storage in Document Editor Component -To save a document to Azure Blob Storage, you can follow the steps below +To save a document to Azure Blob Storage, follow these steps: **Step 1:** Create a Simple [ASP.NET Core DOCX Editor](https://www.syncfusion.com/docx-editor-sdk/asp-net-core-docx-editor) (Document Editor) Sample in ASP.NET Core -Start by following the steps provided in this [link](../../document-editor/getting-started-core) to create a simple Document Editor sample in ASP.NET Core. This will give you a basic setup of the Document Editor component. +Follow the steps in this [link](../../document-editor/getting-started-core) to create a simple Document Editor sample in ASP.NET Core. This will give you a basic setup of the Document Editor component. **Step 2:** Modify the `DocumentEditorController.cs` File in the Web Service Project @@ -27,12 +27,14 @@ Start by following the steps provided in this [link](../../document-editor/getti * Import the required namespaces at the top of the file: ```csharp +using Microsoft.AspNetCore.Cors; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Logging; using System.IO; using Azure.Storage.Blobs; -using Azure.Storage.Blobs.Specialized; ``` -* Add the following private fields and constructor parameters to the `DocumentEditorController` class, In the constructor, assign the values from the configuration to the corresponding fields +* Add the following private fields and a constructor to the `DocumentEditorController` class. In the constructor, assign the configuration values to the corresponding fields. ```csharp private readonly string _storageConnectionString; @@ -47,7 +49,7 @@ public DocumentEditorController(IConfiguration configuration, ILogger 0) - { - return values[0]; - } - } - return ""; -} - ``` -* Open the `appsettings.json` file in your web service project, Add the following lines below the existing `"AllowedHosts"` configuration +* Open the `appsettings.json` file in your web service project. Add the following lines below the existing `"AllowedHosts"` configuration ```json { @@ -109,11 +98,11 @@ private string GetValue(IFormCollection data, string key) } ``` -N> Replace **Your Connection string from Azure** with the actual connection string for your Azure Blob Storage account and **Your container name in Azure** with the actual container name +N> Replace **Your Connection string from Azure** with the actual connection string for your Azure Blob Storage account, and **Your container name in Azure** with the actual container name. **Step 3:** Modify the Index.cshtml File in the Document Editor sample -In the client-side, to export the document into blob the document using `saveAsBlob` and sent to server-side for saving in Azure Blob Storage container. +On the client side, export the document to a blob using `saveAsBlob` and send it to the server for saving in the Azure Blob Storage container. {% tabs %} @@ -126,4 +115,4 @@ In the client-side, to export the document into blob the document using `saveAsB {% endtabs %} -N> The **Azure.Storage.Blobs** NuGet package must be installed in your application to use the previous code example. +N> The **Azure.Storage.Blobs** NuGet package must be installed in your application to use the code above. diff --git a/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/box-cloud-file-storage.md b/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/box-cloud-file-storage.md index 95ee601410..2c62b06f9d 100644 --- a/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/box-cloud-file-storage.md +++ b/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/box-cloud-file-storage.md @@ -1,25 +1,25 @@ --- layout: post -title: Save to Box cloud file Document editor | Syncfusion -description: Learn about how to Save document to Box cloud file storage in ASP.NET Core Document editor control of Syncfusion Essential JS 2 and more details. +title: Save to Box cloud file storage in DOCX Editor | Syncfusion +description: Learn about how to Save document to Box cloud file storage in ASP.NET Core Document Editor component of Syncfusion Essential JS 2 and more details. platform: document-processing control: Save document to Box cloud file storage documentation: ug domainurl: ##DomainURL## --- -# Save document to Box cloud file storage in ASP.NET Core +# Save document to Box cloud file storage in Document Editor Component -To save a document to Box cloud file storage, you can follow the steps below +To save a document to Box cloud file storage, follow these steps: **Step 1:** Set up a Box developer account and create a Box application -To access Box storage programmatically, you'll need a developer account with Box. Go to the [Box Developer Console](https://developer.box.com/guides), sign in or create a new account, and then create a new Box application. This application will provide you with the necessary credentials Client ID and Client Secret to authenticate and access Box APIs. Before accessing files, you need to authenticate your application to access your Box account. Box API supports `OAuth 2.0 authentication` for this purpose. +To access Box storage programmatically, you'll need a developer account with Box. Go to the [Box Developer Console](https://developer.box.com/guides), sign in or create a new account, and then create a new Box application. This application will provide you with the necessary credentials Client ID and Client Secret to authenticate and access Box APIs. Before accessing files, you need to authenticate your application to access your Box account. Box API supports OAuth 2.0 authentication for this purpose. **Step 2:** Create a Simple Document Editor Sample in ASP.NET Core -Start by following the steps provided in this [link](../../document-editor/getting-started-core) to create a simple Document Editor sample in ASP.NET Core. This will give you a basic setup of the Document Editor component. +Follow the steps in this [link](../../document-editor/getting-started-core) to create a simple Document Editor sample in ASP.NET Core. This will give you a basic setup of the Document Editor component. **Step 3:** Modify the `DocumentEditorController.cs` File in the Web Service Project @@ -29,15 +29,22 @@ Start by following the steps provided in this [link](../../document-editor/getti * Import the required namespaces at the top of the file: ```csharp +using Microsoft.AspNetCore.Cors; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Caching.Memory; +using Microsoft.Extensions.Configuration; +using System.IO; using Box.V2; using Box.V2.Auth; using Box.V2.Config; using Box.V2.Models; ``` -* Add the following private fields and constructor parameters to the `DocumentEditorController` class, In the constructor, assign the values from the configuration to the corresponding fields +* Add the following private fields and a constructor to the `DocumentEditorController` class. In the constructor, assign the configuration values to the corresponding fields. ```csharp +private IWebHostEnvironment _hostingEnvironment; +private IMemoryCache _cache; private IConfiguration _configuration; public readonly string _accessToken; public readonly string _clientID; @@ -56,14 +63,14 @@ public DocumentEditorController(IWebHostEnvironment hostingEnvironment, IMemoryC } ``` -* Create the `SaveToBoxCloud()` method to save the downloaded document to Box cloud file storage bucket +* Create the `SaveToBoxCloud()` method to save the document to the Box cloud file storage ```csharp [AcceptVerbs("Post")] [HttpPost] [EnableCors("AllowAllOrigins")] [Route("SaveToBoxCloud")] -//Post action for downloading the document +//Post action for saving the document to Box cloud file storage public void SaveToBoxCloud(IFormCollection data) { @@ -87,6 +94,7 @@ public void SaveToBoxCloud(IFormCollection data) Stream stream = new MemoryStream(); file.CopyTo(stream); + stream.Position = 0; var boxFile = await client.FilesManager.UploadAsync(fileRequest, stream); } @@ -105,7 +113,7 @@ private string GetValue(IFormCollection data, string key) } ``` -* Open the `appsettings.json` file in your web service project, Add the following lines below the existing `"AllowedHosts"` configuration +* Open the `appsettings.json` file in your web service project. Add the following lines below the existing `"AllowedHosts"` configuration ```json { @@ -123,11 +131,11 @@ private string GetValue(IFormCollection data, string key) } ``` -N> replace **Your_Box_Storage_Access_Token** with your actual box access token, and **Your_Folder_ID** with the ID of the folder in your box storage where you want to perform specific operations. Remember to use your valid box API credentials, as **Your_Box_Storage_ClientID** and **Your_Box_Storage_ClientSecret"** are placeholders for your application's API key and secret. +N> Replace **Your_Box_Storage_Access_Token** with your actual Box access token, and **Your_Folder_ID** with the ID of the folder in your Box storage where you want to perform specific operations. Remember to use your valid Box API credentials, as **Your_Box_Storage_ClientID** and **Your_Box_Storage_ClientSecret** are placeholders for your application's API key and secret. **Step 4:** Modify the Index.cshtml File in the Document Editor sample -In the client-side, to export the document into blob the document using `saveAsBlob` and sent to server-side for saving in Box cloud file storage. +On the client side, export the document to a blob using `saveAsBlob` and send it to the server for saving in Box cloud file storage. {% tabs %} @@ -140,4 +148,4 @@ In the client-side, to export the document into blob the document using `saveAsB {% endtabs %} -N> The **Box.V2.Core** NuGet package must be installed in your application to use the previous code example. +N> The **Box.V2.Core** NuGet package must be installed in your web service project to use the code above. diff --git a/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/dropbox-cloud-file-storage.md b/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/dropbox-cloud-file-storage.md index 1fae8b8104..4a1294ea51 100644 --- a/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/dropbox-cloud-file-storage.md +++ b/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/dropbox-cloud-file-storage.md @@ -1,25 +1,25 @@ --- layout: post -title: Save document to Dropbox cloud in Document editor | Syncfusion -description: Learn about how to Save document to Dropbox cloud file storage in ASP.NET Core Document editor control of Syncfusion Essential JS 2 and more details. +title: Save document to Dropbox cloud file storage in DOCX Editor | Syncfusion +description: Learn about how to Save document to Dropbox cloud file storage in ASP.NET Core Document Editor component of Syncfusion Essential JS 2 and more details. platform: document-processing control: Save document to Dropbox cloud file storage documentation: ug domainurl: ##DomainURL## --- -# Save document to Dropbox cloud file storage in ASP.NET Core +# Save document to Dropbox cloud file storage in Document Editor Component -To save a document to Dropbox cloud file storage, you can follow the steps below +To save a document to Dropbox cloud file storage, follow these steps: **Step 1:** Create a Dropbox API -To create a Dropbox API App, you should follow the official documentation provided by Dropbox [link](https://www.dropbox.com/developers/documentation/dotnet#tutorial). The process involves visiting the Dropbox Developer website and using their App Console to set up your API app. This app will allow you to interact with Dropbox programmatically, enabling secure access to files and data. +To create a Dropbox API app, follow the official [Dropbox .NET tutorial](https://www.dropbox.com/developers/documentation/dotnet#tutorial). The process involves visiting the Dropbox Developer website and using their App Console to set up your API app. This app will allow you to interact with Dropbox programmatically, enabling secure access to files and data. **Step 2:** Create a Simple Document Editor Sample in ASP.NET Core -Start by following the steps provided in this [link](../../document-editor/getting-started-core) to create a simple Document Editor sample in ASP.NET Core. This will give you a basic setup of the Document Editor component. +Follow the steps in this [link](../../document-editor/getting-started-core) to create a simple Document Editor sample in ASP.NET Core. This will give you a basic setup of the Document Editor component. **Step 3:** Modify the `DocumentEditorController.cs` File in the Web Service Project @@ -29,14 +29,20 @@ Start by following the steps provided in this [link](../../document-editor/getti * Import the required namespaces at the top of the file: ```csharp +using Microsoft.AspNetCore.Cors; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Caching.Memory; +using Microsoft.Extensions.Configuration; using System.IO; using Dropbox.Api; using Dropbox.Api.Files; ``` -* Add the following private fields and constructor parameters to the `DocumentEditorController` class, In the constructor, assign the values from the configuration to the corresponding fields +* Add the following private fields and a constructor to the `DocumentEditorController` class. In the constructor, assign the configuration values to the corresponding fields. ```csharp +private IWebHostEnvironment _hostingEnvironment; +private IMemoryCache _cache; private IConfiguration _configuration; public readonly string _accessToken; public readonly string _folderName; @@ -51,7 +57,7 @@ public DocumentEditorController(IWebHostEnvironment hostingEnvironment, IMemoryC } ``` -* Create the `SaveToDropBox()` method to save the downloaded document to Dropbox cloud file storage bucket +* Create the `SaveToDropBox()` method to save the document to the Dropbox cloud file storage ```csharp @@ -59,7 +65,7 @@ public DocumentEditorController(IWebHostEnvironment hostingEnvironment, IMemoryC [HttpPost] [EnableCors("AllowAllOrigins")] [Route("SaveToDropBox")] -//Post action for downloading the document +//Post action for saving the document to Dropbox cloud file storage public void SaveToDropBox(IFormCollection data) { @@ -75,6 +81,7 @@ public void SaveToDropBox(IFormCollection data) { Stream stream = new MemoryStream(); file.CopyTo(stream); + stream.Position = 0; // Upload the document to Dropbox var uploadedFile = await dropBox.Files.UploadAsync( @@ -84,7 +91,11 @@ public void SaveToDropBox(IFormCollection data) ); } } +``` + +* Add the following helper method `GetValue` to the `DocumentEditorController` class to read form values from the posted data +```csharp private string GetValue(IFormCollection data, string key) { if (data.ContainsKey(key)) @@ -99,7 +110,7 @@ private string GetValue(IFormCollection data, string key) } ``` -* Open the `appsettings.json` file in your web service project, Add the following lines below the existing `"AllowedHosts"` configuration +* Open the `appsettings.json` file in your web service project. Add the following lines below the existing `"AllowedHosts"` configuration ```json { @@ -119,7 +130,7 @@ N> Replace **Your_Dropbox_Access_Token** with your actual Dropbox access token a **Step 4:** Modify the Index.cshtml File in the Document Editor sample -In the client-side, to export the document into blob the document using `saveAsBlob` and sent to server-side for saving in Dropbox cloud file storage. +On the client side, export the document to a blob using `saveAsBlob` and send it to the server for saving in Dropbox cloud file storage. {% tabs %} @@ -132,4 +143,4 @@ In the client-side, to export the document into blob the document using `saveAsB {% endtabs %} -N> The **Dropbox.Api** NuGet package must be installed in your application to use the previous code example. +N> The **Dropbox.Api** NuGet package must be installed in your web service project to use the code above. diff --git a/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/google-cloud-storage.md b/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/google-cloud-storage.md index 469cbaea47..3d18789eb0 100644 --- a/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/google-cloud-storage.md +++ b/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/google-cloud-storage.md @@ -1,40 +1,46 @@ --- layout: post -title: Save to Google Cloud Storage Document editor | Syncfusion -description: Learn about how to Save document to Google Cloud Storage in ASP.NET Core Document editor control of Syncfusion Essential JS 2 and more details. +title: Save document to Google Cloud Storage in DOCX Editor | Syncfusion +description: Learn about how to Save document to Google Cloud Storage in ASP.NET Core Document Editor component of Syncfusion Essential JS 2 and more details. platform: document-processing control: Save document to Google Cloud Storage documentation: ug domainurl: ##DomainURL## --- -# Save document to Google Cloud Storage in ASP.NET Core +# Save document to Google Cloud Storage in Document Editor Component -To save a document to Google Cloud Storage, you can follow the steps below +To save a document to Google Cloud Storage, follow these steps: **Step 1:** Create a Simple [ASP.NET Core DOCX Editor](https://www.syncfusion.com/docx-editor-sdk/asp-net-core-docx-editor) (Document Editor) Sample in ASP.NET Core -Start by following the steps provided in this [link](../../document-editor/getting-started-core) to create a simple Document Editor sample in ASP.NET Core. This will give you a basic setup of the Document Editor component. +Follow the steps in this [link](../../document-editor/getting-started-core) to create a simple Document Editor sample in ASP.NET Core. This will give you a basic setup of the Document Editor component. -**Step 2:** Create the `DocumentEditorController.cs` File in the Web Service Project +**Step 2:** Modify the `DocumentEditorController.cs` File in the Web Service Project * Open the `DocumentEditorController.cs` file in your web service project. * Import the required namespaces at the top of the file: ```csharp +using Microsoft.AspNetCore.Cors; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Caching.Memory; +using Microsoft.Extensions.Configuration; using System.IO; using Google.Cloud.Storage.V1; using Google.Apis.Auth.OAuth2; ``` -* Add the following private fields and constructor parameters to the `DocumentEditorController` class, In the constructor, assign the values from the configuration to the corresponding fields +* Add the following private fields and a constructor to the `DocumentEditorController` class. In the constructor, assign the configuration values to the corresponding fields. ```csharp // Private readonly object _storageClient private readonly StorageClient _storageClient; +private IWebHostEnvironment _hostingEnvironment; +private IMemoryCache _cache; private IConfiguration _configuration; public readonly string _bucketName; @@ -59,14 +65,15 @@ public DocumentEditorController(IWebHostEnvironment hostingEnvironment, IMemoryC } ``` -* Create the `SaveToGoogleCloud()` method to save the downloaded document to Google Cloud Storage bucket +* Create the `SaveToGoogleCloud()` method to save the document to the Google Cloud Storage bucket ```csharp -[AcceptVerbs("Post")] + [HttpPost] [EnableCors("AllowAllOrigins")] [Route("SaveToGoogleCloud")] -//Post action for downloading the document +//Post action for saving the document to Google Cloud Storage + public void SaveToGoogleCloud(IFormCollection data) { if (data.Files.Count == 0) @@ -74,18 +81,24 @@ public void SaveToGoogleCloud(IFormCollection data) IFormFile file = data.Files[0]; string documentName = this.GetValue(data, "documentName"); - string result = Path.GetFileNameWithoutExtension(documentName); + // Derive the object name from the original document name (without extension) + string documentNameWithoutExt = Path.GetFileNameWithoutExtension(documentName); string bucketName = _bucketName; Stream stream = new MemoryStream(); file.CopyTo(stream); + stream.Position = 0; // Upload the document to Google Cloud Storage - _storageClient.UploadObject(bucketName, result + "_downloaded.docx", null, stream); + _storageClient.UploadObject(bucketName, documentNameWithoutExt + "_downloaded.docx", null, stream); -} +} +``` +* Add the following helper method `GetValue` to the `DocumentEditorController` class to read form values from the posted data + +```csharp private string GetValue(IFormCollection data, string key) { if (data.ContainsKey(key)) @@ -100,7 +113,7 @@ private string GetValue(IFormCollection data, string key) } ``` -* Open the `appsettings.json` file in your web service project, Add the following lines below the existing `"AllowedHosts"` configuration +* Open the `appsettings.json` file in your web service project. Add the following lines below the existing `"AllowedHosts"` configuration ```json { @@ -115,13 +128,13 @@ private string GetValue(IFormCollection data, string key) } ``` -N> Replace **Your Bucket name from Google Cloud Storage** with the actual name of your Google Cloud Storage bucket - -N> Replace **path/to/service-account-key.json** with the actual file path to your service account key JSON file. Make sure to provide the correct path and filename. +N> +1. Replace **Your Bucket name from Google Cloud Storage** with the actual name of your Google Cloud Storage bucket. +2. Replace **path/to/service-account-key.json** with the actual file path to your service account key JSON file. Make sure to provide the correct path and filename. -**Step 4:** Modify the Index.cshtml File in the Document Editor sample +**Step 3:** Modify the Index.cshtml File in the Document Editor sample -In the client-side, to export the document into blob the document using `saveAsBlob` and sent to server-side for saving in Google Cloud Storage. +On the client side, export the document to a blob using `saveAsBlob` and send it to the server for saving in Google Cloud Storage. {% tabs %} @@ -134,4 +147,4 @@ In the client-side, to export the document into blob the document using `saveAsB {% endtabs %} -N> The **Google.Cloud.Storage.V1** NuGet package must be installed in your application to use the previous code example. +N> The **Google.Cloud.Storage.V1** NuGet package must be installed in your web service project to use the code above. From ba48e35aac211480516f708286d548e27e9d8021 Mon Sep 17 00:00:00 2001 From: Krishna Kaviarasu Sethuramasamy Date: Thu, 6 Aug 2026 12:54:58 +0530 Subject: [PATCH 2/4] 1o45866: update google-drive.md --- .../saving-documents/google-drive.md | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/google-drive.md b/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/google-drive.md index 75740a65bb..327179730d 100644 --- a/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/google-drive.md +++ b/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/google-drive.md @@ -1,25 +1,25 @@ --- layout: post -title: Save document to Google Drive in Document editor | Syncfusion -description: Learn about how to Save document to Google Drive in ASP.NET Core Document editor control of Syncfusion Essential JS 2 and more details. +title: Save document to Google Drive in DOCX Editor | Syncfusion +description: Learn about how to Save document to Google Drive in ASP.NET Core Document Editor component of Syncfusion Essential JS 2 and more details. platform: document-processing control: Save document to Google Drive documentation: ug domainurl: ##DomainURL## --- -# Save document to Google Drive in ASP.NET Core +# Save document to Google Drive in Document Editor Component -To save a document to Google Drive, you can follow the steps below +To save a document to Google Drive, follow these steps: **Step 1:** Set up Google Drive API -You must set up a project in the Google Developers Console and enable the Google Drive API. Obtain the necessary credentials to access the API. For more information, view the official [link](https://developers.google.com/drive/api/guides/enable-sdk). +You must set up a project in the Google Developers Console and enable the Google Drive API. Obtain the necessary credentials to access the API. For more information, refer to the official [Enable the Drive API](https://developers.google.com/drive/api/guides/enable-sdk) guide. **Step 2:** Create a Simple Document Editor Sample in ASP.NET Core -Start by following the steps provided in this [link](../../document-editor/getting-started-core) to create a simple Document Editor sample in ASP.NET Core. This will give you a basic setup of the Document Editor component. +Follow the steps in this [link](../../document-editor/getting-started-core) to create a simple Document Editor sample in ASP.NET Core. This will give you a basic setup of the Document Editor component. **Step 3:** Modify the `DocumentEditorController.cs` File in the Web Service Project @@ -34,9 +34,11 @@ using Google.Apis.Drive.v3; using Google.Apis.Util.Store; ``` -* Add the following private fields and constructor parameters to the `DocumentEditorController` class, In the constructor, assign the values from the configuration to the corresponding fields +* Add the following private fields and a constructor to the `DocumentEditorController` class. In the constructor, assign the configuration values to the corresponding fields. ```csharp +private IWebHostEnvironment _hostingEnvironment; +private IMemoryCache _cache; private IConfiguration _configuration; public readonly string folderId; public readonly string applicationName; @@ -54,14 +56,14 @@ public DocumentEditorController(IWebHostEnvironment hostingEnvironment, IMemoryC } ``` -* Create the `SaveToGoogleDrive()` method to save the downloaded document to Google Drive bucket +* Create the `SaveToGoogleDrive()` method to save the document to Google Drive ```csharp [AcceptVerbs("Post")] [HttpPost] [EnableCors("AllowAllOrigins")] [Route("SaveToGoogleDrive")] -//Post action for downloading the document +//Post action for saving the document to Google Drive public void SaveToGoogleDrive(IFormCollection data) { @@ -85,7 +87,7 @@ public void SaveToGoogleDrive(IFormCollection data) CancellationToken.None, new FileDataStore(credPath, true)); } - + // Create the Drive API service. var service = new DriveService(new BaseClientService.Initializer() { @@ -101,13 +103,18 @@ public void SaveToGoogleDrive(IFormCollection data) Stream stream = new MemoryStream(); file.CopyTo(stream); + stream.Position = 0; FilesResource.CreateMediaUpload request; request = service.Files.Create(fileMetadata, stream, "application/pdf"); request.Fields = "id"; object value = await request.UploadAsync(); } +``` + +* Add the following helper method `GetValue` to the `DocumentEditorController` class to read form values from the posted data +```csharp private string GetValue(IFormCollection data, string key) { if (data.ContainsKey(key)) @@ -122,7 +129,7 @@ private string GetValue(IFormCollection data, string key) } ``` -* Open the `appsettings.json` file in your web service project, Add the following lines below the existing `"AllowedHosts"` configuration +* Open the `appsettings.json` file in your web service project. Add the following lines below the existing `"AllowedHosts"` configuration ```json { @@ -139,15 +146,14 @@ private string GetValue(IFormCollection data, string key) } ``` -N> Replace **Your Google Drive Folder ID**, **Your Application name**, and **Your Path to the OAuth 2.0 Client IDs json file** with your actual Google drive folder ID , Your name for your application and the path for the JSON file. - -N> The **FolderId** part is the unique identifier for the folder. For example, if your folder URL is: `https://drive.google.com/drive/folders/abc123xyz456`, then the folder ID is `abc123xyz456`. - -N> You must use a unique `Client_ID` from json file to interface your application with the Google Drive API in order to save document directly to Google Drive. This Client_ID will serve as the authentication key, allowing you to save files securely. +N> +1. Replace **Your Google Drive Folder ID**, **Your Application name**, and **Your Path to the OAuth 2.0 Client IDs json file** with your actual Google Drive folder ID, your application name, and the path to the JSON file. +2. The **FolderId** is the unique identifier for the folder. For example, if your folder URL is `https://drive.google.com/drive/folders/abc123xyz456`, then the folder ID is `abc123xyz456`. +3. The JSON file (`credentials.json`) downloaded from the Google Cloud Console contains your OAuth 2.0 **Client ID** and **Client Secret**. Use these credentials to interface your application with the Google Drive API. **Step 4:** Modify the Index.cshtml File in the Document Editor sample -In the client-side, to export the document into blob the document using `saveAsBlob` and sent to server-side for saving in Google Drive. +On the client side, export the document to a blob using `saveAsBlob` and send it to the server for saving in Google Drive. {% tabs %} @@ -160,4 +166,4 @@ In the client-side, to export the document into blob the document using `saveAsB {% endtabs %} -N> The **Google.Apis.Drive.v3** NuGet package must be installed in your application to use the previous code example. +N> The **Google.Apis.Drive.v3** NuGet package must be installed in your web service project to use the code above. From b4c0bf3a8ea95cd433ba40ba527ffe5afc1dee00 Mon Sep 17 00:00:00 2001 From: Krishna Kaviarasu Sethuramasamy Date: Thu, 6 Aug 2026 15:24:20 +0530 Subject: [PATCH 3/4] 1045866: empty commit From 782c1791cb0ddf9b7443da38faa1b8a613f9f4eb Mon Sep 17 00:00:00 2001 From: Krishna Kaviarasu Sethuramasamy Date: Thu, 6 Aug 2026 15:37:22 +0530 Subject: [PATCH 4/4] 1045866: update title length --- .../saving-documents/dropbox-cloud-file-storage.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/dropbox-cloud-file-storage.md b/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/dropbox-cloud-file-storage.md index 4a1294ea51..386e8f3f18 100644 --- a/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/dropbox-cloud-file-storage.md +++ b/Document-Processing/Word/Word-Processor/asp-net-core/saving-documents/dropbox-cloud-file-storage.md @@ -1,6 +1,6 @@ --- layout: post -title: Save document to Dropbox cloud file storage in DOCX Editor | Syncfusion +title: Save document to Dropbox cloud in DOCX Editor | Syncfusion description: Learn about how to Save document to Dropbox cloud file storage in ASP.NET Core Document Editor component of Syncfusion Essential JS 2 and more details. platform: document-processing control: Save document to Dropbox cloud file storage @@ -8,7 +8,7 @@ documentation: ug domainurl: ##DomainURL## --- -# Save document to Dropbox cloud file storage in Document Editor Component +# Save document to Dropbox cloud in Document Editor Component To save a document to Dropbox cloud file storage, follow these steps: