|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: Docker image deployment in ##Platform_Name## Spreadsheet control | Syncfusion |
| 4 | +description: Learn here all about Docker image deployment in Syncfusion ##Platform_Name## Spreadsheet control of Syncfusion Essential JS 2 and more. |
| 5 | +platform: ej2-asp-core-mvc |
| 6 | +control: Docker deployment |
| 7 | +publishingplatform: ##Platform_Name## |
| 8 | +documentation: ug |
| 9 | +domainurl: ##DomainURL## |
| 10 | +--- |
| 11 | + |
| 12 | +# Docker Image Overview in ##Platform_Name## Spreadsheet control |
| 13 | + |
| 14 | +The [**Syncfusion Spreadsheet (also known as Excel Viewer)**](https://www.syncfusion.com/aspnet-mvc-ui-controls/spreadsheet) 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. |
| 15 | + |
| 16 | +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 6.0. |
| 17 | + |
| 18 | +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). |
| 19 | + |
| 20 | +The Spreadsheet is supported on the [JavaScript](https://www.syncfusion.com/javascript-ui-controls), [Angular](https://www.syncfusion.com/angular-ui-components), [React](https://www.syncfusion.com/react-ui-components), [Vue](https://www.syncfusion.com/vue-ui-components), [ASP.NET Core](https://www.syncfusion.com/aspnet-core-ui-controls), and [ASP.NET MVC](https://www.syncfusion.com/aspnet-mvc-ui-controls) platforms. |
| 21 | + |
| 22 | +## Prerequisites |
| 23 | + |
| 24 | +Have [`Docker`](https://www.docker.com/products/container-runtime#/download) installed in your environment: |
| 25 | + |
| 26 | +* On Windows, install [`Docker for Windows`](https://hub.docker.com/editions/community/docker-ce-desktop-windows). |
| 27 | +* On macOS, install [`Docker for Mac`](https://docs.docker.com/desktop/install/mac-install/). |
| 28 | + |
| 29 | +## How to deploy the Spreadsheet Docker Image |
| 30 | + |
| 31 | +**Step 1:** Pull the spreadsheet-server image from Docker Hub. |
| 32 | + |
| 33 | +```console |
| 34 | +docker pull syncfusion/spreadsheet-server |
| 35 | +``` |
| 36 | + |
| 37 | +**Step 2:** Create the `docker-compose.yml` file with the following code in your file system. |
| 38 | + |
| 39 | +```yaml |
| 40 | +version: '3.4' |
| 41 | + |
| 42 | +services: |
| 43 | + spreadsheet-server: |
| 44 | + image: syncfusion/spreadsheet-server:latest |
| 45 | + environment: |
| 46 | + # Provide your license key for activation |
| 47 | + SYNCFUSION_LICENSE_KEY: YOUR_LICENSE_KEY |
| 48 | + ports: |
| 49 | + - "6002:80" |
| 50 | +``` |
| 51 | +
|
| 52 | +**Note:** The Spreadsheet is a commercial product. It requires a valid [license key](https://help.syncfusion.com/common/essential-studio/licensing/licensing-faq/where-can-i-get-a-license-key) to use in a production environment. Please replace `YOUR_LICENSE_KEY` with the valid license key in the `docker-compose.yml` file. |
| 53 | + |
| 54 | +**Step 3:** In a terminal tab, navigate to the directory where you've placed the `docker-compose.yml` file and execute the following: |
| 55 | + |
| 56 | +```console |
| 57 | +docker-compose up |
| 58 | +``` |
| 59 | + |
| 60 | +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`. |
| 61 | + |
| 62 | +**Step 4:** Append the URLs of the Docker instance running services to the [`openUrl`](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.Spreadsheet.Spreadsheet.html#Syncfusion_EJ2_Spreadsheet_Spreadsheet_OpenUrl) property as `http://localhost:6002/api/spreadsheet/open` and the [`saveUrl`](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.Spreadsheet.Spreadsheet.html#Syncfusion_EJ2_Spreadsheet_Spreadsheet_SaveUrl) property as `http://localhost:6002/api/spreadsheet/save` in the client-side Spreadsheet control. For more information on how to get started with the Spreadsheet control, refer to this [`getting started page.`](https://ej2.syncfusion.com/aspnetcore/documentation/spreadsheet/getting-started-core) |
| 63 | + |
| 64 | +{% if page.publishingplatform == "aspnet-core" %} |
| 65 | + |
| 66 | +{% tabs %} |
| 67 | +{% highlight cshtml tabtitle="CSHTML" %} |
| 68 | + |
| 69 | +``` |
| 70 | +<ejs-spreadsheet id="spreadsheet" openUrl="Open" allowOpen = "true" beforeOpen="beforeOpen"> |
| 71 | + |
| 72 | +</ejs-spreadsheet> |
| 73 | + |
| 74 | +<script> |
| 75 | + |
| 76 | + function beforeOpen(args) { |
| 77 | + // your code snippets here |
| 78 | + } |
| 79 | + |
| 80 | +</script> |
| 81 | +``` |
| 82 | +
|
| 83 | +{% endhighlight %} |
| 84 | +
|
| 85 | +{% highlight c# tabtitle="Opencontroller.cs" %} |
| 86 | +
|
| 87 | +```cs |
| 88 | +public IActionResult Open(IFormCollection openRequest) |
| 89 | +{ |
| 90 | + OpenRequest open = new OpenRequest(); |
| 91 | + open.File = openRequest.Files[0]; |
| 92 | + return Content(Workbook.Open(open)); |
| 93 | +} |
| 94 | +``` |
| 95 | + |
| 96 | +{% endhighlight %} |
| 97 | +{% endtabs %} |
| 98 | + |
| 99 | +{% elsif page.publishingplatform == "aspnet-mvc" %} |
| 100 | + |
| 101 | +{% tabs %} |
| 102 | +{% highlight razor tabtitle="CSHTML" %} |
| 103 | + |
| 104 | +``` |
| 105 | +@Html.EJS().Spreadsheet("spreadsheet").OpenUrl("http://localhost:6002/api/spreadsheet/open").SaveUrl("http://localhost:6002/api/spreadsheet/save").AllowOpen(true).AllowSave(true).BeforeOpen("beforeOpen").Render() |
| 106 | +
|
| 107 | +<script> |
| 108 | +
|
| 109 | + function beforeOpen(args) { |
| 110 | + // your code snippets here |
| 111 | + } |
| 112 | +
|
| 113 | +</script> |
| 114 | +``` |
| 115 | +{% endhighlight %} |
| 116 | +{% highlight c# tabtitle="Opencontroller.cs" %} |
| 117 | +```cs |
| 118 | +public IActionResult Open(IFormCollection openRequest) |
| 119 | +{ |
| 120 | + OpenRequest open = new OpenRequest(); |
| 121 | + open.File = openRequest.Files[0]; |
| 122 | + return Content(Workbook.Open(open)); |
| 123 | +} |
| 124 | +``` |
| 125 | +{% endhighlight %} |
| 126 | +{% endtabs %} |
| 127 | +{% endif %} |
| 128 | + |
| 129 | +## How to configure different cultures using a Docker compose file |
| 130 | + |
| 131 | +By default, the Spreadsheet Docker container is generated in the `en_US` culture. You can configure different cultures using the `LC_ALL`, `LANGUAGE`, and `LANG` environment variables in the `docker-compose.yml` file. These environment variables are replaced in the Docker file to set the specified culture for the Spreadsheet server. |
| 132 | + |
| 133 | +```yaml |
| 134 | +version: '3.4' |
| 135 | + |
| 136 | +services: |
| 137 | + spreadsheet-server: |
| 138 | + image: syncfusion/spreadsheet-server:latest |
| 139 | + environment: |
| 140 | + # Provide your license key for activation |
| 141 | + SYNCFUSION_LICENSE_KEY: YOUR_LICENSE_KEY |
| 142 | + # Specify the culture to configure for the Spreadsheet server |
| 143 | + LC_ALL: de_DE.UTF-8 |
| 144 | + LANGUAGE: de_DE.UTF-8 |
| 145 | + LANG: de_DE.UTF-8 |
| 146 | + ports: |
| 147 | + - "6002:80" |
| 148 | +``` |
| 149 | +
|
| 150 | +Please refer to these getting started pages to create a Spreadsheet in [`Angular`](https://ej2.syncfusion.com/angular/documentation/spreadsheet/getting-started), [`React`](https://ej2.syncfusion.com/react/documentation/spreadsheet/getting-started), [`Vue`](https://ej2.syncfusion.com/vue/documentation/spreadsheet/getting-started), [`ASP.NET Core`](https://ej2.syncfusion.com/aspnetcore/documentation/spreadsheet/getting-started-core), and [`ASP.NET MVC`](https://ej2.syncfusion.com/aspnetmvc/documentation/spreadsheet/getting-started-mvc). |
0 commit comments